summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-19 14:33:13 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-26 13:36:14 (GMT)
commit5ec69eb58c4d863e9f8f278b7c78d08f8cedd3f4 (patch)
tree204366b19fba81e4374cd44cb5816e325bfb258f /CMakeLists.txt
parent3381e6bd5cbfa1694f07c97a19747adda10b06f2 (diff)
downloadCMake-5ec69eb58c4d863e9f8f278b7c78d08f8cedd3f4.zip
CMake-5ec69eb58c4d863e9f8f278b7c78d08f8cedd3f4.tar.gz
CMake-5ec69eb58c4d863e9f8f278b7c78d08f8cedd3f4.tar.bz2
cppdap: Build as part of CMake or use external installation
Add `cm3p/` headers to use the selected copy of the library. Co-authored-by: Glen Chung <kuchung@microsoft.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 23 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6322aa6..9ec6267 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,6 +131,23 @@ if(CMake_BUILD_LTO)
endif()
endif()
+# Check whether to build cppdap.
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ if(NOT DEFINED CMake_ENABLE_CPPDAP)
+ # cppdap does not compile everywhere.
+ if(CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin|Linux|BSD|DragonFly|CYGWIN|MSYS"
+ AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.16)
+ AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.1)
+ )
+ set(CMake_ENABLE_CPPDAP 1)
+ else()
+ set(CMake_ENABLE_CPPDAP 0)
+ endif()
+ endif()
+else()
+ set(CMake_ENABLE_CPPDAP 0)
+endif()
+
#-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script
@@ -141,7 +158,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
# Allow the user to enable/disable all system utility library options by
# defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
- set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV NGHTTP2 ZLIB ZSTD)
+ set(UTILITIES BZIP2 CPPDAP CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV NGHTTP2 ZLIB ZSTD)
foreach(util IN LISTS UTILITIES)
if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
@@ -169,6 +186,9 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
# Optionally use system utility libraries.
option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}")
+ if(CMake_ENABLE_CPPDAP)
+ option(CMAKE_USE_SYSTEM_CPPDAP "Use system-installed cppdap" "${CMAKE_USE_SYSTEM_LIBRARY_CPPDAP}")
+ endif()
option(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" "${CMAKE_USE_SYSTEM_LIBRARY_CURL}")
option(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}")
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
@@ -182,7 +202,8 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_NGHTTP2 "Use system-installed nghttp2"
"${CMAKE_USE_SYSTEM_LIBRARY_NGHTTP2}" "NOT CMAKE_USE_SYSTEM_CURL" ON)
option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
- option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}")
+ CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp"
+ "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}" "NOT CMAKE_USE_SYSTEM_CPPDAP" ON)
option(CMAKE_USE_SYSTEM_LIBRHASH "Use system-installed librhash" "${CMAKE_USE_SYSTEM_LIBRARY_LIBRHASH}")
option(CMAKE_USE_SYSTEM_LIBUV "Use system-installed libuv" "${CMAKE_USE_SYSTEM_LIBRARY_LIBUV}")