From 1b6e71e5612cf6f7d4d72aabaa379651a608e18c Mon Sep 17 00:00:00 2001 From: Matt Blair Date: Tue, 13 Dec 2016 09:41:55 -0500 Subject: [PATCH] Fix custom CMake tasks for tools besides 'make' (#8) The conditional that was here incorrectly accepts tools that have 'make' anywhere in their path (with Android Studio, the ninja binary is in a folder called 'cmake'). This change makes these targets correct for build tools other than 'make'. --- CMakeLists.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b5f618f4..b4af365e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,17 +178,14 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR # set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long ${yaml_cxx_flags}") - ### Make specific - if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake) - add_custom_target(debuggable $(MAKE) clean - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} - COMMENT "Adjusting settings for debug compilation" - VERBATIM) - add_custom_target(releasable $(MAKE) clean - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} - COMMENT "Adjusting settings for release compilation" - VERBATIM) - endif() + add_custom_target(debuggable ${CMAKE_BUILD_TOOL} clean + COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMENT "Adjusting settings for debug compilation" + VERBATIM) + add_custom_target(releasable ${CMAKE_BUILD_TOOL} clean + COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMENT "Adjusting settings for release compilation" + VERBATIM) endif() # Microsoft VisualC++ specialities