I recently switched several projects from autotools to cmake.
One common thing that I loved about autotools is that I go into the src build directory. there is config.log / config.status - where the ./configure --params command is located at the top, so it's easy to restart the old command line flags used.
(for example, after compiling some things - I want to add another --enable-this - copy and paste from config.log / status - and restart ./configure --old-params --enable-this )
in cmake - I have a bunch of -D flags - how can I find the command line used, for example, in config.log / status - with the cmake project?
I know there is CMakeCache ... - but its hard to extract used flags
change
i came up with the following solution:
#save commandline to rebuild this :) set(USED_CMD_LINE "cmake ") set(MY_CMAKE_FLAGS CMAKE_BUILD_TYPE CMAKE_INSTALL_PREFIX ENABLE_SSL ENABLE_LUA ENABLE_SSH ENABLE_SNMP MYSQL_USER MYSQL_PASS MYSQL_HOST MYSQL_DB FULL_FEATURES USE_COVERAGE) FOREACH(cmd_line_loop IN ITEMS ${MY_CMAKE_FLAGS}) if(${cmd_line_loop}) STRING(CONCAT USED_CMD_LINE ${USED_CMD_LINE} "-D" ${cmd_line_loop} "=" ${${cmd_line_loop}} " ") endif() ENDFOREACH(cmd_line_loop) STRING(CONCAT USED_CMD_LINE ${USED_CMD_LINE} " .. ")
creates a config.status file in the build folder - containing all the specified cmake parameters.
about:
- seems to solve my problem.
- seems to work with subsequent cmake calls
against
- Failed to set chmod to
FILE(write ? Variable MY_CMAKE_FLAGS contains known flags - must be manually updated if a new flag is added
considers
cmake
Helmut januschka
source share