aboutsummaryrefslogtreecommitdiff
path: root/cmake/Util.cmake
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /cmake/Util.cmake
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'cmake/Util.cmake')
-rw-r--r--cmake/Util.cmake22
1 files changed, 9 insertions, 13 deletions
diff --git a/cmake/Util.cmake b/cmake/Util.cmake
index f09de78668..8ca39e5f94 100644
--- a/cmake/Util.cmake
+++ b/cmake/Util.cmake
@@ -61,6 +61,7 @@ function(add_glob_target)
if(NOT ARG_COMMAND)
add_custom_target(${ARG_TARGET})
add_custom_command(TARGET ${ARG_TARGET}
+ POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found")
return()
endif()
@@ -175,8 +176,7 @@ function(add_target)
add_custom_target(${target} DEPENDS ${touch_file})
endfunction()
-# Set default build type to BUILD_TYPE. Also limit the list of allowable build
-# types to the ones defined in variable allowableBuildTypes.
+# Set default build type to BUILD_TYPE.
#
# The correct way to specify build type (for example Release) for
# single-configuration generators (Make and Ninja) is to run
@@ -193,28 +193,24 @@ endfunction()
# Passing CMAKE_BUILD_TYPE for multi-config generators will not only not be
# used, but also generate a warning for the user.
function(set_default_buildtype BUILD_TYPE)
- set(allowableBuildTypes Debug Release MinSizeRel RelWithDebInfo)
- if(NOT BUILD_TYPE IN_LIST allowableBuildTypes)
- message(FATAL_ERROR "Invalid build type: ${BUILD_TYPE}")
- endif()
+ set(defaultBuildTypes Debug Release MinSizeRel RelWithDebInfo)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(isMultiConfig)
- # Multi-config generators use the first element in CMAKE_CONFIGURATION_TYPES as the default build type
- list(INSERT allowableBuildTypes 0 ${BUILD_TYPE})
- list(REMOVE_DUPLICATES allowableBuildTypes)
- set(CMAKE_CONFIGURATION_TYPES ${allowableBuildTypes} PARENT_SCOPE)
+ # Multi-config generators use the first element in
+ # CMAKE_CONFIGURATION_TYPES as the default build type
+ list(INSERT defaultBuildTypes 0 ${BUILD_TYPE})
+ list(REMOVE_DUPLICATES defaultBuildTypes)
+ set(CMAKE_CONFIGURATION_TYPES ${defaultBuildTypes} PARENT_SCOPE)
if(CMAKE_BUILD_TYPE)
message(WARNING "CMAKE_BUILD_TYPE specified which is ignored on \
multi-configuration generators. Defaulting to ${BUILD_TYPE} build type.")
endif()
else()
- set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowableBuildTypes}")
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${defaultBuildTypes}")
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not specified, default is '${BUILD_TYPE}'")
set(CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE STRING "Choose the type of build" FORCE)
- elseif(NOT CMAKE_BUILD_TYPE IN_LIST allowableBuildTypes)
- message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
else()
message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
endif()