diff options
| author | Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> | 2020-01-10 00:26:27 +0100 |
|---|---|---|
| committer | dan-shaw <51385773+dan-shaw@users.noreply.github.com> | 2020-01-09 15:26:27 -0800 |
| commit | 504eeea5148510645a884688d04434373054d501 (patch) | |
| tree | 0beb174bcfb1bdae34b87cd7a562b9aeac112488 /scripts | |
| parent | dad1833be46258af233d3461ee965aceaa1f6701 (diff) | |
| download | vcpkg-504eeea5148510645a884688d04434373054d501.tar.gz vcpkg-504eeea5148510645a884688d04434373054d501.zip | |
Map MinSizeRel and RelWithDebInfo correctly (#6393)
* Map MinSizeRel and RelWithDebInfo to Release by default
* switch to CMAKE_CONFIGURATION_TYPES
* changed mapping slightly
* add empty list element to the mapping
* more comments and an option to turn verbose messages on.
* removed line info.
It would require the file name to make sense out of it.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/buildsystems/vcpkg.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 87a206eb1..e549f3fa1 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,6 +1,10 @@ # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) +# VCPKG toolchain options. +option(VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." OFF) +mark_as_advanced(VCPKG_VERBOSE) + # Determine whether the toolchain is loaded during a try-compile configuration get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) @@ -22,6 +26,24 @@ if(VCPKG_TOOLCHAIN) return() endif() +if(DEFINED CMAKE_CONFIGURATION_TYPES) #Generating with a multi config generator + #If CMake does not have a mapping for MinSizeRel and RelWithDebInfo in imported targets + #it will map those configuration to the first valid configuration in CMAKE_CONFIGURATION_TYPES. + #By default this is the debug configuration which is wrong. + if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL) + set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;") + if(VCPKG_VERBOSE) + message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;") + endif() + endif() + if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO) + set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;") + if(VCPKG_VERBOSE) + message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;") + endif() + endif() +endif() + if(VCPKG_TARGET_TRIPLET) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) |
