[CMake] HOW TO: build development versions, plus proper INSTALL setup?

kent williams nkwmailinglists at gmail.com
Mon Mar 9 14:49:15 EDT 2009


I think I've gotten myself needlessly tied into knots over
EXECUTABLE_OUTPUT_PATH vs RUNTIME_OUTPUT_DIRECTORY vs INSTALL command.
 So maybe someone wants to talk me down about it.

We have a suite of programs that are built by a nested set of
directories.  We'd like 2 things to happen (and a third if possible):

1. All the executables generated go into one binary directory. This
directory is what a developer would add to PATH in order to run
programs while he or she is adding source, debugging, etc.
2. When the whole package is installed, likewise, all programs would
go into one directory, most likely ${CMAKE_INSTALL_PREFIX}/bin
3. Test programs should NOT get thrown in with the actual 'product'
programs, and ideally stay in ${LOCALDIR_BINARY_DIR} for the local
project.

Right now, what I'm doing is this:

1. Set CMAKE_RUNTIME_OUTPUT_DIRECTORY and
CMAKE_LIBRARY_OUTPUT_DIRECTORY during the initial cmake configure.
2. using INSTALL(TARGETS ...) for programs
3. When I do an ADD_TEST, I give the test program's command as
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/testprogram, since setting
CMAKE_RUNTIME_OUTPUT_DIRECTORY doesn't discriminate between tests and
end-user programs.

So what _should_ I be doing, if I want to follow the One True CMake way?


More information about the CMake mailing list