Skip to content

Commit

Permalink
Merge pull request #6842 from KratosMultiphysics/fix-cmake-build-type_2
Browse files Browse the repository at this point in the history
Add case where CMAKE_BUILD_TYPE is passed directly to cmake
  • Loading branch information
marandra authored May 2, 2020
2 parents fa023f4 + 972f930 commit a43350e
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,23 @@ SET( CMAKE_MODULE_LINKER_FLAGS_FULLDEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
SET( CMAKE_MODULE_LINKER_FLAGS_CUSTOM "${CMAKE_MODULE_LINKER_FLAGS}")

# If build mode is not defined, assume Release
if(DEFINED ENV{KRATOS_BUILD_TYPE})
list(FIND CMAKE_CONFIGURATION_TYPES $ENV{KRATOS_BUILD_TYPE} FOUND_MODE)
if(FOUND_MODE EQUAL -1)
message("Unknown CMAKE_BUILD_TYPE '${CMAKE_BUILD_TYPE}', using 'Release'.")
set(CMAKE_BUILD_TYPE Release)
else(FOUND_MODE EQUAL -1)
set(CMAKE_BUILD_TYPE $ENV{KRATOS_BUILD_TYPE})
endif(FOUND_MODE EQUAL -1)
else(DEFINED ENV{KRATOS_BUILD_TYPE})
message("--No CMAKE_BUILD_TYPE is defined, building in 'Release' mode.")
set(CMAKE_BUILD_TYPE Release)
endif(DEFINED ENV{KRATOS_BUILD_TYPE})
if(NOT CMAKE_BUILD_TYPE)
if(DEFINED ENV{KRATOS_BUILD_TYPE})
list(FIND CMAKE_CONFIGURATION_TYPES $ENV{KRATOS_BUILD_TYPE} FOUND_MODE)
if(FOUND_MODE EQUAL -1)
message("Unknown CMAKE_BUILD_TYPE '${CMAKE_BUILD_TYPE}', using 'Release'.")
set(CMAKE_BUILD_TYPE Release)
else(FOUND_MODE EQUAL -1)
set(CMAKE_BUILD_TYPE $ENV{KRATOS_BUILD_TYPE})
endif(FOUND_MODE EQUAL -1)
else(DEFINED ENV{KRATOS_BUILD_TYPE})
message("--No CMAKE_BUILD_TYPE is defined, building in 'Release' mode.")
set(CMAKE_BUILD_TYPE Release)
endif(DEFINED ENV{KRATOS_BUILD_TYPE})
endif(NOT CMAKE_BUILD_TYPE)
set (KratosMultiphysics_BUILD_TYPE ${CMAKE_BUILD_TYPE})


if(USE_COTIRE MATCHES ON)
include(cotire)
set(CMAKE_SKIP_RPATH ON)
Expand Down

0 comments on commit a43350e

Please sign in to comment.