Reputation: 2845
Recently I changed from Eclipse/Makefiles to CLion and to the usage of CMake.
Some of the projects that I work on are still based on Makefile
s, but I have the CMakeLists.txt
for symbols/include search.
I added custom targets to run the commands from the Makefile
s, the same way I would add "Build targets" in Eclipse:
add_custom_target(
build
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/my/dir
COMMAND make my_make_target)
Now, if I want to build/clean/test the project I need to choose the specific target and then click on "Build". Is there any faster way to do it?
Upvotes: 0
Views: 341
Reputation: 2339
According to the documentation, you can add the ALL
option to include the target to the default build target (whichever that is)
add_custom_target(
build
ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/my/dir
COMMAND make my_make_target)
Upvotes: 0