File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ include(GNUInstallDirs)
1919# Set default build to release
2020# ---------------------------------------------------------------------------------------
2121if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
22- set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
22+ # Set CMAKE_BUILD_TYPE only if this project is top-level
23+ if ((DEFINED PROJECT_IS_TOP_LEVEL AND PROJECT_IS_TOP_LEVEL)
24+ OR (NOT DEFINED PROJECT_IS_TOP_LEVEL AND CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR ))
25+ set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
26+ endif ()
2327endif ()
2428
2529# ---------------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments