Check for unset CMAKE_BUILD_TYPE

This commit is contained in:
Tom Lankhorst 2019-01-27 13:23:36 +01:00
parent 0789ef541d
commit 9186c8b7d9
No known key found for this signature in database
GPG Key ID: 52BF82B885592251
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,9 @@ function(ipo_enable IPO_ENABLED_BUILDS)
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_LOG)
set(IPO_BUILD_ENABLED OFF PARENT_SCOPE)
if(IPO_SUPPORTED AND ${CMAKE_BUILD_TYPE} IN_LIST IPO_ENABLED_BUILDS)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not explicitly set. Not enabling IPO.")
elseif(IPO_SUPPORTED AND ${CMAKE_BUILD_TYPE} IN_LIST IPO_ENABLED_BUILDS)
if(NOT DISABLE_IPO)
message(STATUS "IPO supported and enabled in ${CMAKE_BUILD_TYPE}.")
set(IPO_BUILD_ENABLED ON PARENT_SCOPE)