[CMake] Idea: generic task-driven make-like targets with CMake
Nils Gladitz
nilsgladitz at gmail.com
Tue Dec 8 13:22:23 EST 2015
On 08.12.2015 19:04, Kevin Wojniak wrote:
>
> add_task(release
> COMMAND ${CMAKE_COMMAND} -E make_directory “build_dir”
> COMMAND ${CMAKE_COMMAND} -E chdir “build_dir” ${CMAKE_COMMAND}
> “-DCMAKE_BUILD_TYPE=Release”, “..”
> )
>
There is add_custom_target().
You can e.g. add_custom_target(release ${CMAKE_COMMAND} -E echo foobar)
and with the Makefiles generator run "make release" and with visual
studio trigger the build of the "release" project.
For scripting you can use cmake in script mode with -P.
e.g. given a script file release.cmake:
message("Hello World")
add_custom_target(release ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_SOURCE_DIR}/release.cmake)
Nils
More information about the CMake
mailing list