Skip to content

Commit

Permalink
Hack a redefinition of mapping of CMAKE_BUILD_TYPE for add_subdirecto…
Browse files Browse the repository at this point in the history
…ry cases.
  • Loading branch information
phcerdan committed Aug 24, 2020
1 parent 4bdc673 commit 1db08c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions physx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ cmake_minimum_required(VERSION 3.13)
# Same values than CMAKE_CONFIGURATION_TYPES
# From https://gitlab.kitware.com/cmake/cmake/issues/19401
get_property(multiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(DEFINED CMAKE_BUILD_TYPE)
# Because CMAKE_BUILD_TYPE is not standard for this project, we will restore the original
# after configuring this project
set(RESTORE_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(CMAKE_BUILD_TYPE "release" CACHE STRING "Choose the type of build.")
else if(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
set(CMAKE_BUILD_TYPE "profile" CACHE STRING "Choose the type of build.")
else if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_BUILD_TYPE "debug" CACHE STRING "Choose the type of build.")
endif()
endif()
if(NOT multiConfig AND NOT DEFINED CMAKE_BUILD_TYPE)
set(default_build_type "release")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
Expand Down Expand Up @@ -176,4 +188,8 @@ if(PX_BUILDPUBLICSAMPLES)
message("Added Samples")
endif()
endif()
# Restore the CMAKE_BUILD_TYPE
if(DEFINED RESTORE_CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${RESTORE_CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build.")
endif()

0 comments on commit 1db08c8

Please sign in to comment.