On Mon, Jan 26, 2015 at 11:00:05 -0500, Ben Boeckel wrote:
> Odd; attached is an HTML dump from Vim for what I see (:TOhtml) where
> variable expansions are highlighted in strings just like outside of
> strings.

Probably help if I actually attached the file :/ .

--Ben
Title: ~/code/depot/group-tools/group-bld/cmake/src/CMakeLists.txt.html
  1 #=============================================================================
  2 # CMake - Cross Platform Makefile Generator
  3 # Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
  4 #
  5 # Distributed under the OSI-approved BSD License (the "License");
  6 # see accompanying file Copyright.txt for details.
  7 #
  8 # This software is distributed WITHOUT ANY WARRANTY; without even the
  9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 10 # See the License for more information.
 11 #=============================================================================
 12 cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
 13 if(POLICY CMP0025)
 14   cmake_policy(SET CMP0025 NEW)
 15 endif()
 16 project(CMake)
 17 
 18 if(CMAKE_BOOTSTRAP)
 19   # Running from bootstrap script.  Set local variable and remove from cache.
 20   set(CMAKE_BOOTSTRAP 1)
 21   unset(CMAKE_BOOTSTRAP CACHE)
 22 endif()
 23 
 24 if(NOT CMake_TEST_EXTERNAL_CMAKE)
 25   set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin)
 26 endif()
 27 
 28 if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
 29   # Disallow architecture-specific try_run.  It may not run on the host.
 30   macro(TRY_RUN)
 31     if(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
 32       message(FATAL_ERROR "TRY_RUN not allowed with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES=[${CMAKE_TRY_COMPILE_OSX_ARCHITECTURES}]")
 33     else()
 34       _TRY_RUN(${ARGV})
 35     endif()
 36   endmacro()
 37 endif()
 38 
 39 # Use most-recent available language dialects with GNU and Clang
 40 if(NOT DEFINED CMAKE_C_STANDARD)
 41   set(CMAKE_C_STANDARD 11)
 42 endif()
 43 if(NOT DEFINED CMAKE_CXX_STANDARD)
 44   set(CMAKE_CXX_STANDARD 14)
 45 endif()
 46 
 47 # option to set the internal encoding of CMake to UTF-8
 48 option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally." ON)
 49 mark_as_advanced(CMAKE_ENCODING_UTF8)
 50 if(CMAKE_ENCODING_UTF8)
 51   set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
 52 endif()
 53 
 54 #-----------------------------------------------------------------------
 55 # a macro to deal with system libraries, implemented as a macro
 56 # simply to improve readability of the main script
 57 #-----------------------------------------------------------------------
 58 macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
 59   # Options have dependencies.
 60   include(CMakeDependentOption)
 61 
 62   # Optionally use system xmlrpc.  We no longer build or use it by default.
 63   option(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF)
 64   mark_as_advanced(CTEST_USE_XMLRPC)
 65 
 66   # Allow the user to enable/disable all system utility library options by
 67   # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
 68   set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA ZLIB)
 69   foreach(util ${UTILITIES})
 70     if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
 71         AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
 72       set(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}")
 73     endif()
 74     if(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util})
 75       if(CMAKE_USE_SYSTEM_LIBRARY_${util})
 76         set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON)
 77       else()
 78         set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF)
 79       endif()
 80       if(CMAKE_BOOTSTRAP)
 81         unset(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE)
 82       endif()
 83       string(TOLOWER "${util}" lutil)
 84       set(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}"
 85         CACHE BOOL "Use system-installed ${lutil}" FORCE)
 86     else()
 87       set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF)
 88     endif()
 89   endforeach()
 90   if(CMAKE_BOOTSTRAP)
 91     unset(CMAKE_USE_SYSTEM_LIBRARIES CACHE)
 92   endif()
 93 
 94   # Optionally use system utility libraries.
 95   option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}")
 96   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl"
 97     "${CMAKE_USE_SYSTEM_LIBRARY_CURL}" "NOT CTEST_USE_XMLRPC" ON)
 98   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat"
 99     "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}" "NOT CTEST_USE_XMLRPC" ON)
100   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
101     "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
102   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
103     "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
104   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
105     "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
106   option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
107   option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}")
108 
109   # Mention to the user what system libraries are being used.
110   foreach(util ${UTILITIES})
111     if(CMAKE_USE_SYSTEM_${util})
112       message(STATUS "Using system-installed ${util}")
113     endif()
114   endforeach()
115 
116   # Inform utility library header wrappers whether to use system versions.
117   configure_file(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in
118     ${CMake_BINARY_DIR}/Utilities/cmThirdParty.h
119     @ONLY)
120 
121 endmacro()
122 
123 
124 
125 
126 if(NOT CMake_TEST_EXTERNAL_CMAKE)
127   set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
128   if(WIN32 AND NOT UNIX AND NOT MINGW)
129     set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
130   endif()
131 endif()
132 
133 
134 #-----------------------------------------------------------------------
135 # a macro to determine the generator and ctest executable to use
136 # for testing. Simply to improve readability of the main script.
137 #-----------------------------------------------------------------------
138 macro(CMAKE_SETUP_TESTING)
139   if(BUILD_TESTING)
140     set(CMAKE_TEST_SYSTEM_LIBRARIES 0)
141     foreach(util CURL EXPAT XMLRPC ZLIB)
142       if(CMAKE_USE_SYSTEM_${util})
143         set(CMAKE_TEST_SYSTEM_LIBRARIES 1)
144       endif()
145     endforeach()
146 
147     # This variable is set by cmake, however to
148     # test cmake we want to make sure that
149     # the ctest from this cmake is used for testing
150     # and not the ctest from the cmake building and testing
151     # cmake.
152     if(CMake_TEST_EXTERNAL_CMAKE)
153       set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest")
154       set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake")
155       set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack")
156       foreach(exe cmake ctest cpack)
157         add_executable(${exe} IMPORTED)
158         set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe})
159       endforeach()
160     else()
161       set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest")
162       set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake")
163       set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack")
164     endif()
165   endif()
166 
167   # configure some files for testing
168   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
169     "${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
170     @ONLY)
171   configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
172     ${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
173   configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
174     ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
175   configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
176     ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
177   if(BUILD_TESTING AND DART_ROOT)
178     configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif
179       ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
180   endif()
181   mark_as_advanced(DART_ROOT)
182   mark_as_advanced(CURL_TESTING)
183 endmacro()
184 
185 
186 # Provide a way for Visual Studio Express users to turn OFF the new FOLDER
187 # organization feature. Default to ON for non-Express users. Express users must
188 # explicitly turn off this option to build CMake in the Express IDE...
189 #
190 option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
191 mark_as_advanced(CMAKE_USE_FOLDERS)
192 
193 
194 #-----------------------------------------------------------------------
195 # a macro that only sets the FOLDER target property if it's
196 # "appropriate"
197 #-----------------------------------------------------------------------
198 macro(CMAKE_SET_TARGET_FOLDER tgt folder)
199   if(CMAKE_USE_FOLDERS)
200     set_property(GLOBAL PROPERTY USE_FOLDERS ON)
201     if(MSVC AND TARGET ${tgt})
202       set_property(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
203     endif()
204   else()
205     set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
206   endif()
207 endmacro()
208 
209 
210 #-----------------------------------------------------------------------
211 # a macro to build the utilities used by CMake
212 # Simply to improve readability of the main script.
213 #-----------------------------------------------------------------------
214 macro (CMAKE_BUILD_UTILITIES)
215   #---------------------------------------------------------------------
216   # Create the kwsys library for CMake.
217   set(KWSYS_NAMESPACE cmsys)
218   set(KWSYS_USE_SystemTools 1)
219   set(KWSYS_USE_Directory 1)
220   set(KWSYS_USE_RegularExpression 1)
221   set(KWSYS_USE_Base64 1)
222   set(KWSYS_USE_MD5 1)
223   set(KWSYS_USE_Process 1)
224   set(KWSYS_USE_CommandLineArguments 1)
225   set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
226   set(KWSYS_INSTALL_DOC_DIR "${CMAKE_DOC_DIR}")
227   add_subdirectory(Source/kwsys)
228   set(kwsys_folder "Utilities/KWSys")
229   CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
230   CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
231   if(BUILD_TESTING)
232     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
233     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
234     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsC "${kwsys_folder}")
235     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsCxx "${kwsys_folder}")
236     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestSharedForward "${kwsys_folder}")
237   endif()
238 
239   #---------------------------------------------------------------------
240   # Setup third-party libraries.
241   # Everything in the tree should be able to include files from the
242   # Utilities directory.
243   include_directories(
244     ${CMake_BINARY_DIR}/Utilities
245     ${CMake_SOURCE_DIR}/Utilities
246     )
247 
248   # check for the use of system libraries versus builtin ones
249   # (a macro defined in this file)
250   CMAKE_HANDLE_SYSTEM_LIBRARIES()
251 
252   #---------------------------------------------------------------------
253   # Build zlib library for Curl, CMake, and CTest.
254   set(CMAKE_ZLIB_HEADER "cm_zlib.h")
255   if(CMAKE_USE_SYSTEM_ZLIB)
256     find_package(ZLIB)
257     if(NOT ZLIB_FOUND)
258       message(FATAL_ERROR
259         "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!")
260     endif()
261     set(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR})
262     set(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
263   else()
264     set(CMAKE_ZLIB_INCLUDES ${CMake_SOURCE_DIR}/Utilities)
265     set(CMAKE_ZLIB_LIBRARIES cmzlib)
266     add_subdirectory(Utilities/cmzlib)
267     CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty")
268   endif()
269 
270   #---------------------------------------------------------------------
271   # Build Curl library for CTest.
272   if(CMAKE_USE_SYSTEM_CURL)
273     find_package(CURL)
274     if(NOT CURL_FOUND)
275       message(FATAL_ERROR
276         "CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!")
277     endif()
278     set(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS})
279     set(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES})
280   else()
281     set(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER})
282     set(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
283     set(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
284     add_definitions(-DCURL_STATICLIB)
285     set(CMAKE_CURL_INCLUDES)
286     set(CMAKE_CURL_LIBRARIES cmcurl)
287     if(CMAKE_TESTS_CDASH_SERVER)
288       set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
289     endif()
290     option(CMAKE_USE_OPENSSL "Use OpenSSL." OFF)
291     mark_as_advanced(CMAKE_USE_OPENSSL)
292     if(CMAKE_USE_OPENSSL)
293       set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
294       set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
295       mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
296     endif()
297     add_subdirectory(Utilities/cmcurl)
298     CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
299     CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
300   endif()
301 
302   #---------------------------------------------------------------------
303   # Build Compress library for CTest.
304   set(CMAKE_COMPRESS_INCLUDES
305     "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
306   set(CMAKE_COMPRESS_LIBRARIES "cmcompress")
307   add_subdirectory(Utilities/cmcompress)
308   CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty")
309   if(CMAKE_USE_SYSTEM_BZIP2)
310     find_package(BZip2)
311   else()
312     set(BZIP2_INCLUDE_DIR
313       "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
314     set(BZIP2_LIBRARIES cmbzip2)
315     add_subdirectory(Utilities/cmbzip2)
316     CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
317   endif()
318 
319   #---------------------------------------------------------------------
320   # Build or use system liblzma for libarchive.
321   if(CMAKE_USE_SYSTEM_LIBLZMA)
322     find_package(LibLZMA)
323     if(NOT LIBLZMA_FOUND)
324       message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
325     endif()
326     set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
327     set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
328   else()
329     add_subdirectory(Utilities/cmliblzma)
330     CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
331     set(LZMA_INCLUDE_DIR
332       "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
333     set(LZMA_LIBRARY cmliblzma)
334   endif()
335 
336   #---------------------------------------------------------------------
337   # Build or use system libarchive for CMake and CTest.
338   if(CMAKE_USE_SYSTEM_LIBARCHIVE)
339     find_package(LibArchive)
340     if(NOT LibArchive_FOUND)
341       message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
342     endif()
343     set(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS})
344     set(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES})
345   else()
346     set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
347     set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
348     add_definitions(-DLIBARCHIVE_STATIC)
349     set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle")
350     set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL")
351     set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found")
352     set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found")
353     set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found")
354     set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
355     set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system found PCREPOSIX library if found")
356     set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system found LibGCC library if found")
357     set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
358     set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support")
359     set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support")
360     add_subdirectory(Utilities/cmlibarchive)
361     CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
362     set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
363   endif()
364 
365   #---------------------------------------------------------------------
366   # Build expat library for CMake and CTest.
367   if(CMAKE_USE_SYSTEM_EXPAT)
368     find_package(EXPAT)
369     if(NOT EXPAT_FOUND)
370       message(FATAL_ERROR
371         "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
372     endif()
373     set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
374     set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
375   else()
376     set(CMAKE_EXPAT_INCLUDES)
377     set(CMAKE_EXPAT_LIBRARIES cmexpat)
378     add_subdirectory(Utilities/cmexpat)
379     CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
380   endif()
381 
382   #---------------------------------------------------------------------
383   # Build jsoncpp library.
384   if(CMAKE_USE_SYSTEM_JSONCPP)
385     if(EXISTS ${CMAKE_ROOT}/Modules/FindJsonCpp.cmake)
386       find_package(JsonCpp)
387     elseif(NOT CMAKE_VERSION VERSION_LESS 3.0)
388       include(${CMake_SOURCE_DIR}/Modules/FindJsonCpp.cmake)
389     else()
390       message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0")
391     endif()
392     if(NOT JsonCpp_FOUND)
393       message(FATAL_ERROR
394         "CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!")
395     endif()
396     set(CMAKE_JSONCPP_LIBRARIES JsonCpp::JsonCpp)
397   else()
398     set(CMAKE_JSONCPP_LIBRARIES cmjsoncpp)
399     add_subdirectory(Utilities/cmjsoncpp)
400     CMAKE_SET_TARGET_FOLDER(cmjsoncpp "Utilities/3rdParty")
401   endif()
402 
403   #---------------------------------------------------------------------
404   # Build XMLRPC library for CMake and CTest.
405   if(CTEST_USE_XMLRPC)
406     find_package(XMLRPC QUIET REQUIRED libwww-client)
407     if(NOT XMLRPC_FOUND)
408       message(FATAL_ERROR
409         "CTEST_USE_XMLRPC is ON but xmlrpc is not found!")
410     endif()
411     set(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS})
412     set(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES})
413   endif()
414 
415   #---------------------------------------------------------------------
416   # Use curses?
417   if (UNIX)
418     # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
419     if(NOT CMAKE_SYSTEM_NAME MATCHES syllable)
420       set(CURSES_NEED_NCURSES TRUE)
421       find_package(Curses QUIET)
422       if (CURSES_LIBRARY)
423         option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
424       else ()
425         message("Curses libraries were not found. Curses GUI for CMake will not be built.")
426         set(BUILD_CursesDialog 0)
427       endif ()
428     else()
429       set(BUILD_CursesDialog 0)
430     endif()
431   else ()
432     set(BUILD_CursesDialog 0)
433   endif ()
434   if(BUILD_CursesDialog)
435     if(NOT CMAKE_USE_SYSTEM_FORM)
436       add_subdirectory(Source/CursesDialog/form)
437     elseif(NOT CURSES_FORM_LIBRARY)
438       message( FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but CURSES_FORM_LIBRARY is not set!" )
439     endif()
440   endif()
441 endmacro ()
442 
443 #-----------------------------------------------------------------------
444 if(NOT CMake_TEST_EXTERNAL_CMAKE)
445   if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
446     execute_process(COMMAND ${CMAKE_CXX_COMPILER}
447       ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
448       OUTPUT_VARIABLE _GXX_VERSION
449     )
450     string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
451       _GXX_VERSION_SHORT ${_GXX_VERSION})
452     if(_GXX_VERSION_SHORT EQUAL 33)
453       message(FATAL_ERROR
454         "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n"
455         "Please use GXX 4.2 or greater to build CMake on OpenBSD\n"
456         "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}")
457     endif()
458   endif()
459 endif()
460 
461 #-----------------------------------------------------------------------
462 # The main section of the CMakeLists file
463 #
464 #-----------------------------------------------------------------------
465 # Compute CMake_VERSION, etc.
466 include(Source/CMakeVersionCompute.cmake)
467 
468 # Include the standard Dart testing module
469 enable_testing()
470 include (${CMAKE_ROOT}/Modules/Dart.cmake)
471 
472 # Set up test-time configuration.
473 set_directory_properties(PROPERTIES
474   TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")
475 
476 if(NOT CMake_TEST_EXTERNAL_CMAKE)
477   # where to write the resulting executables and libraries
478   set(BUILD_SHARED_LIBS OFF)
479   set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")
480   set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
481     "Where to put the libraries for CMake")
482 
483   # The CMake executables usually do not need any rpath to run in the build or
484   # install tree.
485   set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
486 
487   # Load install destinations.
488   include(Source/CMakeInstallDestinations.cmake)
489 
490   if(BUILD_TESTING)
491     include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
492   endif()
493 
494   # include special compile flags for some compilers
495   include(CompileFlags.cmake)
496 
497   # no clue why we are testing for this here
498   include(CheckSymbolExists)
499   CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
500   CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
501 endif()
502 
503 # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
504 #
505 # If not defined or "", this variable defaults to the server at
506 # "http://open.cdash.org".
507 #
508 # If set explicitly to "NOTFOUND", curl tests and ctest tests that use
509 # the network are skipped.
510 #
511 # If set to something starting with "http://localhost/", the CDash is
512 # expected to be an instance of CDash used for CDash testing, pointing
513 # to a cdash4simpletest database. In these cases, the CDash dashboards
514 # should be run first.
515 #
516 if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
517   set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
518 endif()
519 
520 # Create the KWIML library for CMake.
521 set(KWIML cmIML)
522 set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
523 add_subdirectory(Utilities/KWIML)
524 
525 if(NOT CMake_TEST_EXTERNAL_CMAKE)
526   # build the utilities (a macro defined in this file)
527   CMAKE_BUILD_UTILITIES()
528 
529   # On NetBSD ncurses is required, since curses doesn't have the wsyncup()
530   # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
531   # which isn't in the default linker search path. So without RPATH ccmake
532   # doesn't run and the build doesn't succeed since ccmake is executed for
533   # generating the documentation.
534   if(BUILD_CursesDialog)
535     get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
536     set(CURSES_NEED_RPATH FALSE)
537     if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
538       set(CURSES_NEED_RPATH TRUE)
539     endif()
540   endif()
541 
542   if(BUILD_QtDialog)
543     if(APPLE)
544       set(CMAKE_BUNDLE_VERSION
545         "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
546       set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
547       # make sure CMAKE_INSTALL_PREFIX ends in /
548       string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
549       math(EXPR LEN "${LEN} -1" )
550       string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
551       if(NOT "${ENDCH}" STREQUAL "/")
552         set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
553       endif()
554       set(CMAKE_INSTALL_PREFIX
555         "${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
556     endif()
557 
558     set(QT_NEED_RPATH FALSE)
559     if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
560       set(QT_NEED_RPATH TRUE)
561     endif()
562   endif()
563 
564 
565   # The same might be true on other systems for other libraries.
566   # Then only enable RPATH if we have are building at least with cmake 2.4,
567   # since this one has much better RPATH features than cmake 2.2.
568   # The executables are then built with the RPATH for the libraries outside
569   # the build tree, which is both the build and the install RPATH.
570   if (UNIX)
571     if(   CMAKE_USE_SYSTEM_CURL   OR  CMAKE_USE_SYSTEM_ZLIB
572           OR  CMAKE_USE_SYSTEM_EXPAT  OR  CTEST_USE_XMLRPC  OR  CURSES_NEED_RPATH  OR  QT_NEED_RPATH)
573       set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
574       set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
575       set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
576     endif()
577   endif ()
578 
579 
580   # add the uninstall support
581   configure_file(
582     "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
583     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
584     @ONLY)
585   add_custom_target(uninstall
586     "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
587 
588   include (CMakeCPack.cmake)
589 
590 endif()
591 
592 # setup some Testing support (a macro defined in this file)
593 CMAKE_SETUP_TESTING()
594 
595 if(NOT CMake_TEST_EXTERNAL_CMAKE)
596   if(NOT CMake_VERSION_IS_RELEASE)
597     if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
598         NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
599       set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
600                        -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
601                        -Wmissing-format-attribute -fno-common -Wundef
602       )
603       set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
604                          -Wshadow -Wpointer-arith -Wformat-security -Wundef
605       )
606 
607       foreach(FLAG_LANG  C CXX)
608         foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
609           if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
610             set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
611           endif()
612         endforeach()
613       endforeach()
614 
615       unset(C_FLAGS_LIST)
616       unset(CXX_FLAGS_LIST)
617     endif()
618   endif()
619 
620   # build the remaining subdirectories
621   add_subdirectory(Source)
622   add_subdirectory(Utilities)
623 endif()
624 
625 add_subdirectory(Tests)
626 
627 if(NOT CMake_TEST_EXTERNAL_CMAKE)
628   if(BUILD_TESTING)
629     CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
630   endif()
631   CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
632   if(TARGET documentation)
633     CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
634   endif()
635 endif()
636 
637 # add a test
638 add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
639   --system-information  -G "${CMAKE_GENERATOR}" )
640 
641 if(NOT CMake_TEST_EXTERNAL_CMAKE)
642   # Install license file as it requires.
643   install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
644 
645   # Install script directories.
646   install(
647     DIRECTORY Help Modules Templates
648     DESTINATION ${CMAKE_DATA_DIR}
649     FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
650     DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
651                           GROUP_READ GROUP_EXECUTE
652                           WORLD_READ WORLD_EXECUTE
653     PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
654                                 GROUP_READ GROUP_EXECUTE
655                                 WORLD_READ WORLD_EXECUTE
656     )
657 
658   # Install auxiliary files integrating with other tools.
659   add_subdirectory(Auxiliary)
660 endif()
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to