CMake: build consistently with default (unspecified) target

This commit is contained in:
Edward Hennis
2017-03-21 15:45:56 -04:00
committed by Nik Bougalis
parent 2449f9c18d
commit fab3ec0b56

View File

@@ -12,13 +12,17 @@ endif()
macro(parse_target)
if (NOT target AND NOT CMAKE_BUILD_TYPE)
if (NOT target)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
string(TOLOWER ${CMAKE_BUILD_TYPE} target)
if (APPLE)
set(target clang.debug)
set(target clang.${target})
elseif(WIN32)
set(target msvc)
else()
set(target gcc.debug)
set(target gcc.${target})
endif()
endif()
@@ -105,6 +109,7 @@ macro(parse_target)
endif()
endwhile()
endif()
# Promote these values to the CACHE, then unset the locals
# to prevent shadowing.
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE FILEPATH
@@ -139,7 +144,6 @@ macro(parse_target)
"Choose the type of build, options are in CMAKE_CONFIGURATION_TYPES"
FORCE)
unset(CMAKE_BUILD_TYPE)
endif()
endmacro()