Skip to content

Commit

Permalink
Fix custom CMake tasks for tools besides 'make' (jbeder#8)
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
matteblair authored and hjanetzek committed Nov 18, 2018
1 parent aa97234 commit 1b6e71e
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b6e71e

Please sign in to comment.