add-custom-command

CMake: execute a macro/function as the command of add_custom_command

こ雲淡風輕ζ 提交于 2019-12-22 09:49:42
问题 I'm using an external library which provides a CMake function for automatic code generation, to be used in my CMakeLists. The problem is that whenever I modify a CMakeLists then the function is run again, triggering the recompilation of the newly generated but unchanged sources. I'd need something like add_custom_command with the possibility to specify the CMake function as COMMAND instead of an executable, so that the function is run only if the automatically generated files are not already

How to call a CMake function from add_custom_target/command?

时光怂恿深爱的人放手 提交于 2019-12-17 10:59:17
问题 Is it possible to call a CMake function out of an add_custom_target or add_custom_command ? I know I could move the CMake function to a Python (or whatever) script and call it from add_custom_target / command but I would like to avoid having tons of script next to the existing CMake infra. What I want to achieve is to use CPack for generating a zip package of binary artifacts and publish them in an artifact repository. For the publishing part I have already the CMake function created but now

How to call a CMake function from add_custom_target/command?

我只是一个虾纸丫 提交于 2019-12-17 10:59:11
问题 Is it possible to call a CMake function out of an add_custom_target or add_custom_command ? I know I could move the CMake function to a Python (or whatever) script and call it from add_custom_target / command but I would like to avoid having tons of script next to the existing CMake infra. What I want to achieve is to use CPack for generating a zip package of binary artifacts and publish them in an artifact repository. For the publishing part I have already the CMake function created but now

How to Run a Basic `add_custom_command` in CMake

百般思念 提交于 2019-12-13 18:32:13
问题 I'm just trying to get a basic CMake example up and running that can run some basic command line commands. I've been researching this for a while and I haven't had any luck. Am I completely using this wrong? Any and all input would be greatly appreciated. cmake_minimum_required(VERSION 3.0) add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/test.txt COMMAND echo "Hello world" COMMENT "This is a comment. But it's not printed during the build?" ) return() Edit: Using: add_custom_target(run

cmake add_custom_command that is executed on every build

不羁岁月 提交于 2019-12-13 00:37:39
问题 I want to have something in CMake that will be executed whenever I enter make add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build_date.cc PRE_BUILD COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mk_build_date.py ${CMAKE_CURRENT_BINARY_DIR}/build_date.cc ) add_custom_target(build-date-xxx ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/build_date.cc) thats what I'm currently doing. unfortunately make build-date-xxx will generate the file only once. even without the add_custom_target declaration the file

CMake: add_custom_command with PRE_BUILD does not work

我的梦境 提交于 2019-12-11 03:13:27
问题 In the following CMakeLists.txt file, although I have set an add_custom_command command with PRE_BUILD option, the custom command is not always executed before making the main executable: cmake_minimum_required(VERSION 2.8) project(VersioningTest) set(MAJOR 1) set(MINOR 0) set(PATCH 0) set(PRODUCT App-${MAJOR}-${MINOR}-${PATCH}) ADD_EXECUTABLE(${PRODUCT} main.cpp Engine.cpp) add_custom_command(TARGET ${PRODUCT} PRE_BUILD COMMAND ${CMAKE_COMMAND} -DMAJOR=${MAJOR} -DMINOR=${MINOR} -DPATCH=$

add_custom_command — update dependency list over rebuilds

允我心安 提交于 2019-12-09 18:58:47
问题 See last status update Initial conditions code generator that generates set of c++ sources taking one input file as parameter input file may include other input files already solved task of getting list of output files, parsing input codegen files to get full list of codegen inputs. I.e. add_custom_command is provided with correct set of dependencies for the first time: add_custom_command(OUTPUT ${generatedSources} COMMAND ${codegenCommand} ARGS ${codegenArgs} DEPENDS ${codegenInputFiles})

CMake: execute a macro/function as the command of add_custom_command

南楼画角 提交于 2019-12-05 22:10:51
I'm using an external library which provides a CMake function for automatic code generation, to be used in my CMakeLists. The problem is that whenever I modify a CMakeLists then the function is run again, triggering the recompilation of the newly generated but unchanged sources. I'd need something like add_custom_command with the possibility to specify the CMake function as COMMAND instead of an executable, so that the function is run only if the automatically generated files are not already present. Is this feasible? If not, does it exist another way to obtain the same result? Thanks. To

add_custom_command — update dependency list over rebuilds

不羁的心 提交于 2019-12-04 13:03:46
See last status update Initial conditions code generator that generates set of c++ sources taking one input file as parameter input file may include other input files already solved task of getting list of output files, parsing input codegen files to get full list of codegen inputs. I.e. add_custom_command is provided with correct set of dependencies for the first time: add_custom_command(OUTPUT ${generatedSources} COMMAND ${codegenCommand} ARGS ${codegenArgs} DEPENDS ${codegenInputFiles}) Problem scenario current system works well until someone modifies one of codegen input files to include

How to add_custom_command() for the CMake build process itself?

戏子无情 提交于 2019-12-02 09:14:08
问题 Is there any way to do the equivalent of add_custom_command (run an external script when a certain file changes), but for something that should be run during CMake script execution itself? (That is, for dependency graph generation.) We have our source code files split up into multiple sub-libraries, and there are configuration files which list which source file goes with which library. (The format of these configuration files are fixed by another tool we use.) Currently, we run a custom