[cmake-developers] non-default executables (was: akademy summary)

Brad King brad.king at kitware.com
Mon Oct 2 11:21:27 EDT 2006


Alexander Neundorf wrote:
> There were also some wishes:
[snip]
> 3) provide a target to build the tests, and don't build the test binaries by 
> default without having to adjust a cmake option
> 
> I'll have a look whether this is possible with the current feature set of 
> CMake, I already talked with Bill about it.

If the executables are test-specific then they should be created in
tests driven by ctest --build-and-test.  However if there is a whole set
of tests that use one target you could consider making them first-class
targets that are not built by default.

I've added a NOT_IN_ALL option for ADD_LIBRARY and ADD_EXECUTABLE.  This
should let you do it:

ADD_EXECUTABLE(myTestExe NOT_IN_ALL ...)
ADD_CUSTOM_TARGET(test_executables)
ADD_DEPENDENCIES(test_executables myTestExe)

There is no way to make the "test" target depend on this though because
it is not a first-class target during the CMake configure stage.  Fixing
this may require changing the GLOBAL_TARGETs added by the generators to
be created before the configure stage, but this is a can of worms and
cannot be done in a 2.4 patch release :(

-Brad


/cvsroot/CMake/CMake/Source/cmAddExecutableCommand.cxx,v  <--
cmAddExecutableCommand.cxx
new revision: 1.27; previous revision: 1.26
/cvsroot/CMake/CMake/Source/cmAddExecutableCommand.h,v  <--
cmAddExecutableCommand.h
new revision: 1.15; previous revision: 1.14
/cvsroot/CMake/CMake/Source/cmAddLibraryCommand.cxx,v  <--
cmAddLibraryCommand.cxx
new revision: 1.25; previous revision: 1.24
/cvsroot/CMake/CMake/Source/cmAddLibraryCommand.h,v  <--
cmAddLibraryCommand.h
new revision: 1.16; previous revision: 1.15
/cvsroot/CMake/CMake/Source/cmMakefile.cxx,v  <--  cmMakefile.cxx
new revision: 1.357; previous revision: 1.356
/cvsroot/CMake/CMake/Source/cmMakefile.h,v  <--  cmMakefile.h
new revision: 1.193; previous revision: 1.192
/cvsroot/CMake/CMake/Tests/Complex/Executable/CMakeLists.txt,v  <--
CMakeLists.txt
new revision: 1.54; previous revision: 1.53
/cvsroot/CMake/CMake/Tests/Complex/Executable/notInAllExe.cxx,v  <--
notInAllExe.cxx
initial revision: 1.1
/cvsroot/CMake/CMake/Tests/Complex/Library/CMakeLists.txt,v  <--
CMakeLists.txt
new revision: 1.36; previous revision: 1.35
/cvsroot/CMake/CMake/Tests/Complex/Library/notInAllLib.cxx,v  <--
notInAllLib.cxx
initial revision: 1.1


More information about the cmake-developers mailing list