aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_common_definitions.cmake
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@hamburg.de>2019-09-20 12:24:23 +0200
committerAlexander Neumann <alexander.neumann@hamburg.de>2019-09-20 12:24:23 +0200
commit5b1e426929b40a9b60809284993b424b841a28fc (patch)
treebd12300ad859bababb7d4acc03700fd31949fddc /scripts/cmake/vcpkg_common_definitions.cmake
parent279e25aecfe30f55296881ea9b0236c1d6ee030a (diff)
parent358ec0954d9b71b0def4fd4b4dbafdd0b8478d81 (diff)
downloadvcpkg-5b1e426929b40a9b60809284993b424b841a28fc.tar.gz
vcpkg-5b1e426929b40a9b60809284993b424b841a28fc.zip
Merge remote-tracking branch 'upstream/master' into path_separator
# Conflicts: # scripts/cmake/vcpkg_common_definitions.cmake
Diffstat (limited to 'scripts/cmake/vcpkg_common_definitions.cmake')
-rw-r--r--scripts/cmake/vcpkg_common_definitions.cmake55
1 files changed, 40 insertions, 15 deletions
diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake
index df8c0a06c..75a1e8a9c 100644
--- a/scripts/cmake/vcpkg_common_definitions.cmake
+++ b/scripts/cmake/vcpkg_common_definitions.cmake
@@ -6,17 +6,22 @@
## ```cmake
## VCPKG_TARGET_IS_<target> with <target> being one of the following: WINDOWS, UWP, LINUX, OSX, ANDROID, FREEBSD. only defined if <target>
## VCPKG_HOST_PATH_SEPARATOR Host specific path separator
-## VCPKG_HOST_PATH_SEPARATOR_ESCAPED Escaped version of VCPKG_HOST_PATH_SEPARATOR if necessary (e.g. symbol with special meaning in cmake like ";")
+## VCPKG_HOST_PATH_SEPARATOR_ESCAPED Escaped version of VCPKG_HOST_PATH_SEPARATOR if necessary (set to VCPKG_HOST_PATH_SEPARATOR if not necessary)
## VCPKG_HOST_EXECUTABLE_SUFFIX executable suffix of the host
## VCPKG_TARGET_EXECUTABLE_SUFFIX executable suffix of the target
## VCPKG_TARGET_STATIC_LIBRARY_PREFIX static library prefix for target (same as CMAKE_STATIC_LIBRARY_PREFIX)
## VCPKG_TARGET_STATIC_LIBRARY_SUFFIX static library suffix for target (same as CMAKE_STATIC_LIBRARY_SUFFIX)
## VCPKG_TARGET_SHARED_LIBRARY_PREFIX shared library prefix for target (same as CMAKE_SHARED_LIBRARY_PREFIX)
## VCPKG_TARGET_SHARED_LIBRARY_SUFFIX shared library suffix for target (same as CMAKE_SHARED_LIBRARY_SUFFIX)
+## VCPKG_TARGET_IMPORT_LIBRARY_PREFIX import library prefix for target (same as CMAKE_IMPORT_LIBRARY_PREFIX)
+## VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX import library suffix for target (same as CMAKE_IMPORT_LIBRARY_SUFFIX)
+## VCPKG_FIND_LIBRARY_PREFIXES target dependent prefixes used for find_library calls in portfiles
+## VCPKG_FIND_LIBRARY_SUFFIXES target dependent suffixes used for find_library calls in portfiles
## ```
-##
-## CMAKE_STATIC_LIBRARY_PREFIX, CMAKE_STATIC_LIBRARY_SUFFIX, CMAKE_SHARED_LIBRARY_PREFIX, CMAKE_SHARED_LIBRARY_SUFFIX are defined for the target so that
-## portfiles are able to use find_library calls to discover dependent libraries within the current triplet for ports.
+##
+## CMAKE_STATIC_LIBRARY_(PREFIX|SUFFIX), CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX) and CMAKE_IMPORT_LIBRARY_(PREFIX|SUFFIX) are defined for the target
+## Furthermore the variables CMAKE_FIND_LIBRARY_(PREFIXES|SUFFIXES) are also defined for the target so that
+## portfiles are able to use find_library calls to discover dependent libraries within the current triplet for ports.
##
#Helper variable to identify the Target system. VCPKG_TARGET_IS_<targetname>
@@ -37,11 +42,12 @@ endif()
#Helper variable to identify the host path separator.
if(CMAKE_HOST_WIN32)
- set(VCPKG_HOST_PATH_SEPARATOR ";")
- set(VCPKG_HOST_PATH_SEPARATOR_ESCAPED "\\;") #sometimes needed to differentiate between the cmake list separator
+ set(VCPKG_HOST_PATH_SEPARATOR "\;") #Is escaped here because else VCPKG_HOST_PATH_SEPARATOR will be a list of two empty elements
+ set(VCPKG_HOST_PATH_SEPARATOR_ESCAPED "\\\;") #Needed if you want to pass around variables with VCPKG_HOST_PATH_SEPARATOR
elseif(CMAKE_HOST_UNIX)
set(VCPKG_HOST_PATH_SEPARATOR ":")
- set(VCPKG_HOST_PATH_SEPARATOR_ESCAPED ":")
+ set(VCPKG_HOST_PATH_SEPARATOR_ESCAPED ${VCPKG_HOST_PATH_SEPARATOR})
+endif()
#Helper variables to identify executables on host/target
if(CMAKE_HOST_WIN32)
@@ -57,25 +63,44 @@ else()
set(VCPKG_TARGET_EXECUTABLE_SUFFIX "")
endif()
-#Helper variables for libraries
+#Helper variables for libraries
if(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
+ set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "")
+ set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "")
+ set(VCPKG_FIND_LIBRARY_SUFFIXES ".lib" ".dll") #This is a slight modification to CMakes value which does not include ".dll".
+ set(VCPKG_FIND_LIBRARY_PREFIXES "" "lib") #This is a slight modification to CMakes value which does not include "lib".
+ ## For CYGWIN and Windows GNU, maybe VCPKG will support that in the future?
+ #set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".dll.a")
+ #set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "lib")
+ #set(VCPKG_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
+ #set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
+elseif(VCPKG_TARGET_IS_OSX)
+ set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
+ set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib")
+ set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
+ set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
+ set(VCPKG_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
+ set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
else()
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
+ set(VCPKG_FIND_LIBRARY_SUFFIXES ".so" ".a")
+ set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
endif()
#Setting these variables allows find_library to work in script mode and thus in portfiles!
#This allows us scale down on hardcoded target dependent paths in portfiles
-set(CMAKE_STATIC_LIBRARY_SUFFIX ${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX})
-set(CMAKE_SHARED_LIBRARY_SUFFIX ${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX})
-set(CMAKE_STATIC_LIBRARY_PREFIX ${VCPKG_TARGET_STATIC_LIBRARY_PREFIX})
-set(CMAKE_SHARED_LIBRARY_PREFIX ${VCPKG_TARGET_SHARED_LIBRARY_PREFIX})
-set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX};${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") # Required by find_library
-set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_STATIC_LIBRARY_PREFIX};${CMAKE_SHARED_LIBRARY_PREFIX}" CACHE INTERNAL "") # Required by find_library
-
+set(CMAKE_STATIC_LIBRARY_SUFFIX "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
+set(CMAKE_SHARED_LIBRARY_SUFFIX "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
+set(CMAKE_IMPORT_LIBRARY_SUFFIX "${VCPKG_TARGET_IMPORT_LIBRARY_PREFIX}")
+set(CMAKE_STATIC_LIBRARY_PREFIX "${VCPKG_TARGET_STATIC_LIBRARY_PREFIX}")
+set(CMAKE_SHARED_LIBRARY_PREFIX "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}")
+set(CMAKE_IMPORT_LIBRARY_PREFIX "${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}")
+set(CMAKE_FIND_LIBRARY_SUFFIXES "${VCPKG_FIND_LIBRARY_SUFFIXES}" CACHE INTERNAL "") # Required by find_library
+set(CMAKE_FIND_LIBRARY_PREFIXES "${VCPKG_FIND_LIBRARY_PREFIXES}" CACHE INTERNAL "") # Required by find_library