Skip to content

CMake emulate make check and exclude tests from ‘all’ target #103

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
zbeekman opened this issue May 28, 2015 · 1 comment · Fixed by #104
Closed

CMake emulate make check and exclude tests from ‘all’ target #103

zbeekman opened this issue May 28, 2015 · 1 comment · Fixed by #104

Comments

@zbeekman
Copy link
Contributor

After some lengthy discussions with the folks at Homebrew regarding submitting a Homebrew formula, I started to get curious about CMake’s idiosyncratic test target and whether it might make more sense to define our own target to allow:

  • tests to be excluded from the all and install targets, allowing faster build and install of just the library
  • a command that will compile and run the tests in one shot (CMake, by design does not build tests when make test is run)

This wiki article describes a way to emulate GNU autotools make check so that tests are not built by default, but running make check will (re—if needed)build tests and then run them. This isn’t strictly necessary but could speed things up for some people and/or for some CI jobs. Although, for the CI jobs, the majority of the time lost is spent waiting for the job to start, not for it to run…

Some further discussion of the topic can be found on Stack Exchange

zbeekman added a commit to zbeekman/json-fortran that referenced this issue May 29, 2015
 - Fixes jacobwilliams#103
 - Provide `check` target that will build tests
 - Tests are no longer included in the `all` target
 - `make check` will build in parallel: the static and dynamic library,
   all tests and run them with `ctest`
 - `make` will build the library and documentation if enabled
@zbeekman
Copy link
Contributor Author

zbeekman commented Jun 1, 2015

FYI, json-fortran is on rosetta code, not sure who added it, but pretty cool.

zbeekman added a commit to zbeekman/json-fortran that referenced this issue Jun 8, 2015
 - Don't forget to update the homebrew forumula via PR when a new
   version is tagged.  - Currently the --HEAD option will fail when
   installing with homebrew due to the recent resolution of jacobwilliams#103. Line #
   30 of json-fortran.rb needs to be replaced with `system "make",
   "check" if build.with? "test"` as the `all` target no longer will
   build the test executables as per jacobwilliams#103
zbeekman added a commit to zbeekman/json-fortran that referenced this issue Jun 8, 2015
 - Don't forget to update the homebrew forumula via PR when a new
   version is tagged.

 - Currently the --HEAD option will fail when installing with homebrew
   due to the recent resolution of jacobwilliams#103. Line # 30 of json-fortran.rb
   needs to be replaced with `system "make", "check" if build.with?
   "test"` as the `all` target no longer will build the test executables
   as per jacobwilliams#103
zbeekman added a commit to zbeekman/json-fortran that referenced this issue Jun 8, 2015
 - Don't forget to update the homebrew forumula via PR when a new
   version is tagged.

 - Currently the --HEAD option will fail when installing with homebrew
   due to the recent resolution of jacobwilliams#103. Line # 30 of json-fortran.rb
   needs to be replaced with `system "make", "check" if build.with?
   "test"` as the `all` target no longer will build the test executables
   as per jacobwilliams#103
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant