summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt25
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Utilities/cmThirdParty.h.in1
-rw-r--r--Utilities/cm_kwiml.h11
-rw-r--r--Utilities/cmjsoncpp/CMakeLists.txt1
-rwxr-xr-xbootstrap14
6 files changed, 48 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 932d07e..9381f35 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,8 +138,13 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
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}")
+ # For now use system KWIML only if explicitly requested rather
+ # than activating via the general system libs options.
+ option(CMAKE_USE_SYSTEM_KWIML "Use system-installed KWIML" OFF)
+ mark_as_advanced(CMAKE_USE_SYSTEM_KWIML)
+
# Mention to the user what system libraries are being used.
- foreach(util ${UTILITIES})
+ foreach(util ${UTILITIES} KWIML)
if(CMAKE_USE_SYSTEM_${util})
message(STATUS "Using system-installed ${util}")
endif()
@@ -270,6 +275,20 @@ macro (CMAKE_BUILD_UTILITIES)
# (a macro defined in this file)
CMAKE_HANDLE_SYSTEM_LIBRARIES()
+ if(CMAKE_USE_SYSTEM_KWIML)
+ find_package(KWIML 1.0)
+ if(NOT KWIML_FOUND)
+ message(FATAL_ERROR "CMAKE_USE_SYSTEM_KWIML is ON but KWIML is not found!")
+ endif()
+ set(CMake_KWIML_LIBRARIES kwiml::kwiml)
+ else()
+ set(CMake_KWIML_LIBRARIES "")
+ if(BUILD_TESTING)
+ set(KWIML_TEST_ENABLE 1)
+ endif()
+ add_subdirectory(Utilities/KWIML)
+ endif()
+
#---------------------------------------------------------------------
# Build zlib library for Curl, CMake, and CTest.
set(CMAKE_ZLIB_HEADER "cm_zlib.h")
@@ -538,10 +557,10 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
endif()
-if(BUILD_TESTING)
+if(CMake_TEST_EXTERNAL_CMAKE)
set(KWIML_TEST_ENABLE 1)
+ add_subdirectory(Utilities/KWIML)
endif()
-add_subdirectory(Utilities/KWIML)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
# build the utilities (a macro defined in this file)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index f23331b..ab70568 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -566,6 +566,7 @@ target_link_libraries(CMakeLib cmsys
${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
${CMAKE_CURL_LIBRARIES}
${CMAKE_JSONCPP_LIBRARIES}
+ ${CMake_KWIML_LIBRARIES}
)
# On Apple we need CoreFoundation
diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in
index 0cb6809..4c1177c 100644
--- a/Utilities/cmThirdParty.h.in
+++ b/Utilities/cmThirdParty.h.in
@@ -15,6 +15,7 @@
/* Whether CMake is using its own utility libraries. */
#cmakedefine CMAKE_USE_SYSTEM_CURL
#cmakedefine CMAKE_USE_SYSTEM_EXPAT
+#cmakedefine CMAKE_USE_SYSTEM_KWIML
#cmakedefine CMAKE_USE_SYSTEM_ZLIB
#cmakedefine CMAKE_USE_SYSTEM_BZIP2
#cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE
diff --git a/Utilities/cm_kwiml.h b/Utilities/cm_kwiml.h
index 2e1a108..ab2b80b 100644
--- a/Utilities/cm_kwiml.h
+++ b/Utilities/cm_kwiml.h
@@ -12,7 +12,14 @@
#ifndef cm_kwiml_h
#define cm_kwiml_h
-#include "KWIML/include/kwiml/abi.h"
-#include "KWIML/include/kwiml/int.h"
+/* Use the KWIML library configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_KWIML
+# include <kwiml/abi.h>
+# include <kwiml/int.h>
+#else
+# include "KWIML/include/kwiml/abi.h"
+# include "KWIML/include/kwiml/int.h"
+#endif
#endif
diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt
index 1c863f8..d0114e7 100644
--- a/Utilities/cmjsoncpp/CMakeLists.txt
+++ b/Utilities/cmjsoncpp/CMakeLists.txt
@@ -23,3 +23,4 @@ include_directories(
)
add_library(cmjsoncpp ${JSONCPP_SOURCES})
+target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES})
diff --git a/bootstrap b/bootstrap
index 860b5e4..9e30363 100755
--- a/bootstrap
+++ b/bootstrap
@@ -450,6 +450,18 @@ cmake_error()
exit ${res}
}
+cmake_generate_file ()
+{
+ OUTFILE="$1"
+ CONTENT="$2"
+ echo "$CONTENT" > "$OUTFILE.tmp"
+ if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
+ rm -f "$OUTFILE.tmp"
+ else
+ mv -f "$OUTFILE.tmp" "$OUTFILE"
+ fi
+}
+
# Replace KWSYS_NAMESPACE with cmsys
cmake_replace_string ()
{
@@ -1270,6 +1282,8 @@ for a in ${KWSYS_FILES}; do
"${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
done
+cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
+
# Generate Makefile
dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
objs=""