summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CTestCustom.cmake.in5
-rw-r--r--Docs/cmake-completion10
-rw-r--r--Docs/cmake-mode.el1
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake206
-rw-r--r--Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in2
-rw-r--r--Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in9
-rw-r--r--Modules/CMakeCXXInformation.cmake14
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake8
-rw-r--r--Modules/CMakeFortranInformation.cmake8
-rw-r--r--Modules/CPack.cmake144
-rw-r--r--Modules/CPackBundle.cmake12
-rw-r--r--Modules/CPackComponent.cmake59
-rw-r--r--Modules/CPackDMG.cmake70
-rw-r--r--Modules/CPackDeb.cmake38
-rw-r--r--Modules/CPackNSIS.cmake42
-rw-r--r--Modules/CPackPackageMaker.cmake34
-rw-r--r--Modules/CPackRPM.cmake115
-rw-r--r--Modules/CheckCCompilerFlag.cmake2
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake3
-rw-r--r--Modules/CheckIncludeFiles.cmake10
-rw-r--r--Modules/CheckLanguage.cmake65
-rw-r--r--Modules/FeatureSummary.cmake2
-rw-r--r--Modules/FindALSA.cmake19
-rw-r--r--Modules/FindBISON.cmake5
-rw-r--r--Modules/FindBLAS.cmake204
-rw-r--r--Modules/FindBZip2.cmake26
-rw-r--r--Modules/FindCUDA.cmake2
-rw-r--r--Modules/FindCURL.cmake24
-rw-r--r--Modules/FindCups.cmake65
-rw-r--r--Modules/FindEXPAT.cmake24
-rw-r--r--Modules/FindFLEX.cmake6
-rw-r--r--Modules/FindFreetype.cmake28
-rw-r--r--Modules/FindGLUT.cmake34
-rw-r--r--Modules/FindGettext.cmake64
-rw-r--r--Modules/FindGit.cmake17
-rw-r--r--Modules/FindGnuTLS.cmake9
-rw-r--r--Modules/FindGnuplot.cmake16
-rw-r--r--Modules/FindImageMagick.cmake52
-rw-r--r--Modules/FindJasper.cmake30
-rw-r--r--Modules/FindLAPACK.cmake91
-rw-r--r--Modules/FindLibArchive.cmake5
-rw-r--r--Modules/FindLibXml2.cmake21
-rw-r--r--Modules/FindLibXslt.cmake20
-rw-r--r--Modules/FindLua51.cmake14
-rw-r--r--Modules/FindOpenMP.cmake205
-rw-r--r--Modules/FindOpenSSL.cmake78
-rw-r--r--Modules/FindPNG.cmake11
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake6
-rw-r--r--Modules/FindPerl.cmake39
-rw-r--r--Modules/FindPerlLibs.cmake70
-rw-r--r--Modules/FindPkgConfig.cmake25
-rw-r--r--Modules/FindPostgreSQL.cmake32
-rw-r--r--Modules/FindProtobuf.cmake13
-rw-r--r--Modules/FindPythonInterp.cmake70
-rw-r--r--Modules/FindQt3.cmake5
-rw-r--r--Modules/FindQt4.cmake5
-rw-r--r--Modules/FindRuby.cmake76
-rw-r--r--Modules/FindSDL.cmake10
-rw-r--r--Modules/FindSDL_image.cmake7
-rw-r--r--Modules/FindSDL_mixer.cmake7
-rw-r--r--Modules/FindSDL_net.cmake7
-rw-r--r--Modules/FindSDL_sound.cmake6
-rw-r--r--Modules/FindSDL_ttf.cmake7
-rw-r--r--Modules/FindTCL.cmake12
-rw-r--r--Modules/FindTIFF.cmake13
-rw-r--r--Modules/FindTclsh.cmake12
-rw-r--r--Modules/FindThreads.cmake47
-rw-r--r--Modules/FindX11.cmake18
-rw-r--r--Modules/FindosgPresentation.cmake52
-rw-r--r--Modules/FindosgQt.cmake52
-rw-r--r--Modules/GenerateExportHeader.cmake2
-rw-r--r--Modules/GetPrerequisites.cmake29
-rw-r--r--Modules/NSIS.template.in4
-rw-r--r--Modules/Qt4Macros.cmake8
-rw-r--r--Modules/SelectLibraryConfigurations.cmake7
-rw-r--r--Modules/UseJava.cmake56
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackDocumentMacros.cxx16
-rw-r--r--Source/CPack/cmCPackDocumentMacros.h21
-rw-r--r--Source/CPack/cmCPackDocumentVariables.cxx32
-rw-r--r--Source/CPack/cmCPackDocumentVariables.h21
-rw-r--r--Source/CPack/cmCPackGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx6
-rw-r--r--Source/CPack/cpack.cxx94
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/CursesDialog/ccmake.cxx1
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx11
-rw-r--r--Source/QtDialog/CMakeLists.txt4
-rw-r--r--Source/QtDialog/CMakeSetup.cxx1
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx3
-rw-r--r--Source/QtDialog/QCMake.cxx13
-rw-r--r--Source/QtDialog/QCMake.h5
-rw-r--r--Source/cmAddExecutableCommand.cxx9
-rw-r--r--Source/cmAddExecutableCommand.h4
-rw-r--r--Source/cmAddLibraryCommand.cxx8
-rw-r--r--Source/cmAddLibraryCommand.h5
-rw-r--r--Source/cmCommand.h11
-rw-r--r--Source/cmComputeLinkInformation.cxx14
-rw-r--r--Source/cmComputeLinkInformation.h1
-rw-r--r--Source/cmCoreTryCompile.cxx13
-rw-r--r--Source/cmDocumentVariables.cxx2
-rw-r--r--Source/cmDocumentation.cxx471
-rw-r--r--Source/cmDocumentation.h70
-rw-r--r--Source/cmFindLibraryCommand.cxx18
-rw-r--r--Source/cmFindPackageCommand.cxx9
-rw-r--r--Source/cmFunctionCommand.cxx11
-rw-r--r--Source/cmGlobalGenerator.cxx17
-rw-r--r--Source/cmGlobalGenerator.h3
-rw-r--r--Source/cmIfCommand.cxx1
-rw-r--r--Source/cmInstallCommand.cxx196
-rw-r--r--Source/cmInstallCommand.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx15
-rw-r--r--Source/cmMacroCommand.cxx11
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmMakefile.h3
-rw-r--r--Source/cmSystemTools.cxx16
-rw-r--r--Source/cmSystemTools.h9
-rw-r--r--Source/cmTarget.cxx84
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx56
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h1
-rw-r--r--Source/cmake.cxx51
-rw-r--r--Source/cmake.h2
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
-rw-r--r--Tests/BundleUtilities/CMakeLists.txt49
-rw-r--r--Tests/BundleUtilities/testbundleutils3.cpp33
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depC.cpp2
-rw-r--r--Tests/CMakeLists.txt114
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt69
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt8
-rw-r--r--Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt (renamed from Tests/Module/CheckCXXCompilerFlag/CMakeLists.txt)16
-rw-r--r--Tests/CMakeOnly/CheckLanguage/CMakeLists.txt22
-rw-r--r--Tests/CMakeOnly/TargetScope/CMakeLists.txt13
-rw-r--r--Tests/CMakeOnly/TargetScope/Sib/CMakeLists.txt6
-rw-r--r--Tests/CMakeOnly/TargetScope/Sub/CMakeLists.txt9
-rw-r--r--Tests/CMakeOnly/TargetScope/Sub/Sub/CMakeLists.txt6
-rw-r--r--Tests/CMakeTests/If-Invalid-Argument.cmake2
-rw-r--r--Tests/CMakeTests/IfTest.cmake.in8
-rw-r--r--Tests/COnly/CMakeLists.txt2
-rw-r--r--Tests/COnly/testCModule.c6
-rw-r--r--Tests/Complex/CMakeLists.txt32
-rw-r--r--Tests/Contracts/Trilinos-10-6/Patch.cmake18
-rw-r--r--Tests/ConvLibrary/CMakeLists.txt20
-rw-r--r--Tests/ConvLibrary/bar.c4
-rw-r--r--Tests/ConvLibrary/bartest.cxx37
-rw-r--r--Tests/ConvLibrary/foo.cxx4
-rw-r--r--Tests/ConvLibrary/sub1/car.cxx4
-rw-r--r--Tests/CxxOnly/CMakeLists.txt2
-rw-r--r--Tests/CxxOnly/testCxxModule.cxx6
-rw-r--r--Tests/LoadCommand/CMakeCommands/CMakeLists.txt3
-rw-r--r--Tests/LoadCommand/CMakeLists.txt6
-rw-r--r--Tests/LoadCommand/LoadedCommand.h.in6
-rw-r--r--Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp2
-rw-r--r--Tests/Module/GenerateExportHeader/override_symbol/main.cpp2
-rw-r--r--Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp2
-rw-r--r--Tests/Module/GenerateExportHeader/prefix/main.cpp2
-rw-r--r--Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp2
-rw-r--r--Tests/README34
-rw-r--r--Tests/VSGNUFortran/CMakeLists.txt26
-rw-r--r--Tests/VSGNUFortran/c_code/CMakeLists.txt2
-rw-r--r--Tests/VSGNUFortran/c_code/main.c7
-rw-r--r--Tests/VSGNUFortran/runtest.cmake.in23
-rw-r--r--Tests/VSGNUFortran/subdir/CMakeLists.txt16
-rw-r--r--Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt46
-rw-r--r--Tests/VSGNUFortran/subdir/fortran/hello.f7
-rw-r--r--Tests/VSGNUFortran/subdir/fortran/world.f6
-rw-r--r--Utilities/KWIML/ABI.h.in10
-rw-r--r--Utilities/Release/dashmacmini2_release.cmake4
-rw-r--r--Utilities/Release/dashmacmini5_release.cmake2
-rw-r--r--Utilities/Release/magrathea_release.cmake2
-rw-r--r--Utilities/cmcurl/CMakeLists.txt5
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_platform.h5
174 files changed, 3603 insertions, 1113 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 1a46688..9eee655 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -1,3 +1,7 @@
+SET(CTEST_CUSTOM_ERROR_MATCH
+ ${CTEST_CUSTOM_ERROR_MATCH}
+ "ERROR:")
+
SET(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
"xtree.[0-9]+. : warning C4702: unreachable code"
@@ -44,6 +48,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast
"ld: warning: directory not found for option .-(F|L)"
"warning.*This version of Mac OS X is unsupported"
+ "clang.*: warning: argument unused during compilation: .-g"
# Ignore clang's summary warning, assuming prior text has matched some
# other warning expression:
diff --git a/Docs/cmake-completion b/Docs/cmake-completion
index d82d608..d70ac24 100644
--- a/Docs/cmake-completion
+++ b/Docs/cmake-completion
@@ -130,6 +130,16 @@ _cpack()
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
+ --help-variable)
+ local running=$(for x in `cpack --help-variable-list | grep -v "cpack version" `; do echo ${x} ; done )
+ COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
+ return 0
+ ;;
+ --help-command)
+ local running=$(for x in `cpack --help-command-list | grep -v "cpack version" `; do echo ${x} ; done )
+ COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
+ return 0
+ ;;
*)
;;
esac
diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el
index 2f51f83..4418bfa 100644
--- a/Docs/cmake-mode.el
+++ b/Docs/cmake-mode.el
@@ -99,6 +99,7 @@ set the path with these commands:
(setq region (buffer-substring-no-properties (point) point-start))
(while (and (not (bobp))
(or (looking-at cmake-regex-blank)
+ (cmake-line-starts-inside-string)
(not (and (string-match cmake-regex-indented region)
(= (length region) (match-end 0))))))
(forward-line -1)
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
new file mode 100644
index 0000000..abd9100
--- /dev/null
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -0,0 +1,206 @@
+# - Use MinGW gfortran from VS if a fortran compiler is not found.
+# The 'add_fortran_subdirectory' function adds a subdirectory
+# to a project that contains a fortran only sub-project. The module
+# will check the current compiler and see if it can support fortran.
+# If no fortran compiler is found and the compiler is MSVC, then
+# this module will find the MinGW gfortran. It will then use
+# an external project to build with the MinGW tools. It will also
+# create imported targets for the libraries created. This will only
+# work if the fortran code is built into a dll, so BUILD_SHARED_LIBS
+# is turned on in the project. In addition the CMAKE_GNUtoMS option
+# is set to on, so that the MS .lib files are created.
+# Usage is as follows:
+# cmake_add_fortran_subdirectory(
+# <subdir> # name of subdirectory
+# PROJECT <project_name> # project name in subdir top CMakeLists.txt
+# ARCHIVE_DIR <dir> # dir where project places .lib files
+# RUNTIME_DIR <dir> # dir where project places .dll files
+# LIBRARIES <lib>... # names of library targets to import
+# LINK_LIBRARIES # link interface libraries for LIBRARIES
+# [LINK_LIBS <lib> <dep>...]...
+# CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake
+# NO_EXTERNAL_INSTALL # skip installation of external project
+# )
+# Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect
+# to the build directory corresponding to the source directory in which the
+# function is invoked.
+#
+# Limitations:
+#
+# NO_EXTERNAL_INSTALL is required for forward compatibility with a
+# future version that supports installation of the external project
+# binaries during "make install".
+
+#=============================================================================
+# Copyright 2011-2012 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
+include(CheckLanguage)
+include(ExternalProject)
+include(CMakeParseArguments)
+
+function(_setup_mingw_config_and_build source_dir build_dir)
+ # Look for a MinGW gfortran.
+ find_program(MINGW_GFORTRAN
+ NAMES gfortran
+ PATHS
+ c:/MinGW/bin
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
+ )
+ if(NOT MINGW_GFORTRAN)
+ message(FATAL_ERROR
+ "gfortran not found, please install MinGW with the gfortran option."
+ "Or set the cache variable MINGW_GFORTRAN to the full path. "
+ " This is required to build")
+ endif()
+
+ # Validate the MinGW gfortran we found.
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_mingw_target "Target:.*64.*mingw")
+ else()
+ set(_mingw_target "Target:.*mingw32")
+ endif()
+ execute_process(COMMAND "${MINGW_GFORTRAN}" -v
+ ERROR_VARIABLE out ERROR_STRIP_TRAILING_WHITESPACE)
+ if(NOT "${out}" MATCHES "${_mingw_target}")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR
+ "MINGW_GFORTRAN is set to\n"
+ " ${MINGW_GFORTRAN}\n"
+ "which is not a MinGW gfortran for this architecture. "
+ "The output from -v does not match \"${_mingw_target}\":\n"
+ "${out}\n"
+ "Set MINGW_GFORTRAN to a proper MinGW gfortran for this architecture."
+ )
+ endif()
+
+ # Configure scripts to run MinGW tools with the proper PATH.
+ get_filename_component(MINGW_PATH ${MINGW_GFORTRAN} PATH)
+ file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH)
+ string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
+ configure_file(
+ ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in
+ ${build_dir}/config_mingw.cmake
+ @ONLY)
+ configure_file(
+ ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in
+ ${build_dir}/build_mingw.cmake
+ @ONLY)
+endfunction()
+
+function(_add_fortran_library_link_interface library depend_library)
+ set_target_properties(${library} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "${depend_library}")
+endfunction()
+
+
+function(cmake_add_fortran_subdirectory subdir)
+ # Parse arguments to function
+ set(options NO_EXTERNAL_INSTALL)
+ set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR)
+ set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE)
+ cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if(NOT ARGS_NO_EXTERNAL_INSTALL)
+ message(FATAL_ERROR
+ "Option NO_EXTERNAL_INSTALL is required (for forward compatibility) "
+ "but was not given."
+ )
+ endif()
+
+ # if we are not using MSVC without fortran support
+ # then just use the usual add_subdirectory to build
+ # the fortran library
+ check_language(Fortran)
+ if(NOT (MSVC AND (NOT CMAKE_Fortran_COMPILER)))
+ add_subdirectory(${subdir})
+ return()
+ endif()
+
+ # if we have MSVC without Intel fortran then setup
+ # external projects to build with mingw fortran
+
+ set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
+ set(project_name "${ARGS_PROJECT}")
+ set(library_dir "${ARGS_ARCHIVE_DIR}")
+ set(binary_dir "${ARGS_RUNTIME_DIR}")
+ set(libraries ${ARGS_LIBRARIES})
+ # use the same directory that add_subdirectory would have used
+ set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
+ foreach(dir_var library_dir binary_dir)
+ if(NOT IS_ABSOLUTE "${${dir_var}}")
+ get_filename_component(${dir_var}
+ "${CMAKE_CURRENT_BINARY_DIR}/${${dir_var}}" ABSOLUTE)
+ endif()
+ endforeach()
+ # create build and configure wrapper scripts
+ _setup_mingw_config_and_build("${source_dir}" "${build_dir}")
+ # create the external project
+ externalproject_add(${project_name}_build
+ SOURCE_DIR ${source_dir}
+ BINARY_DIR ${build_dir}
+ CONFIGURE_COMMAND ${CMAKE_COMMAND}
+ -P ${build_dir}/config_mingw.cmake
+ BUILD_COMMAND ${CMAKE_COMMAND}
+ -P ${build_dir}/build_mingw.cmake
+ INSTALL_COMMAND ""
+ )
+ # make the external project always run make with each build
+ externalproject_add_step(${project_name}_build forcebuild
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/${project_name}-build
+ DEPENDEES configure
+ DEPENDERS build
+ ALWAYS 1
+ )
+ # create imported targets for all libraries
+ foreach(lib ${libraries})
+ add_library(${lib} SHARED IMPORTED GLOBAL)
+ set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
+ set_target_properties(${lib} PROPERTIES
+ IMPORTED_IMPLIB_NOCONFIG "${library_dir}/lib${lib}.lib"
+ IMPORTED_LOCATION_NOCONFIG "${binary_dir}/lib${lib}.dll"
+ )
+ add_dependencies(${lib} ${project_name}_build)
+ endforeach()
+
+ # now setup link libraries for targets
+ set(start FALSE)
+ set(target)
+ foreach(lib ${ARGS_LINK_LIBRARIES})
+ if("${lib}" STREQUAL "LINK_LIBS")
+ set(start TRUE)
+ else()
+ if(start)
+ if(DEFINED target)
+ # process current target and target_libs
+ _add_fortran_library_link_interface(${target} "${target_libs}")
+ # zero out target and target_libs
+ set(target)
+ set(target_libs)
+ endif()
+ # save the current target and set start to FALSE
+ set(target ${lib})
+ set(start FALSE)
+ else()
+ # append the lib to target_libs
+ list(APPEND target_libs "${lib}")
+ endif()
+ endif()
+ endforeach()
+ # process anything that is left in target and target_libs
+ if(DEFINED target)
+ _add_fortran_library_link_interface(${target} "${target_libs}")
+ endif()
+endfunction()
diff --git a/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in
new file mode 100644
index 0000000..55b271a
--- /dev/null
+++ b/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in
@@ -0,0 +1,2 @@
+set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
+execute_process(COMMAND "@CMAKE_COMMAND@" --build . )
diff --git a/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in
new file mode 100644
index 0000000..97f6769
--- /dev/null
+++ b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in
@@ -0,0 +1,9 @@
+set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
+set(CMAKE_COMMAND_LINE "@ARGS_CMAKE_COMMAND_LINE@")
+execute_process(
+ COMMAND "@CMAKE_COMMAND@" "-GMinGW Makefiles"
+ -DCMAKE_Fortran_COMPILER:PATH=@MINGW_GFORTRAN@
+ -DBUILD_SHARED_LIBS=ON
+ -DCMAKE_GNUtoMS=ON
+ ${CMAKE_COMMAND_LINE}
+ "@source_dir@")
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index b97a69c..25abb8c 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -93,12 +93,6 @@ IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
ENDIF()
-# for most systems a module is the same as a shared library
-# so unless the variable CMAKE_MODULE_EXISTS is set just
-# copy the values from the LIBRARY variables
-IF(NOT CMAKE_MODULE_EXISTS)
- SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
-ENDIF(NOT CMAKE_MODULE_EXISTS)
# Create a set of shared library variable specific to C++
# For 90% of the systems, these are the same flags as the C versions
# so if these are not set just copy the flags from the c version
@@ -158,6 +152,14 @@ IF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
SET(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C})
ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+IF(NOT CMAKE_MODULE_EXISTS)
+ SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
+ SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS})
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
# repeat for modules
IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS)
SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index efcba29..ade6d58 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -50,7 +50,7 @@ IF(NOT CMAKE_Fortran_COMPILER)
# fort77: native F77 compiler under HP-UX (and some older Crays)
# frt: Fujitsu F77 compiler
# pathf90/pathf95/pathf2003: PathScale Fortran compiler
- # pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers
+ # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers
# xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers
# lf95: Lahey-Fujitsu F95 compiler
# fl32: Microsoft Fortran 77 "PowerStation" compiler
@@ -64,8 +64,8 @@ IF(NOT CMAKE_Fortran_COMPILER)
# then 77 or older compilers, gnu is always last in the group,
# so if you paid for a compiler it is picked by default.
SET(CMAKE_Fortran_COMPILER_LIST
- ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 lf95 xlf95 fort
- gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77
+ ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95
+ fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77
frt pgf77 xlf fl32 af77 g77 f77
)
@@ -73,7 +73,7 @@ IF(NOT CMAKE_Fortran_COMPILER)
SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77)
SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc)
SET(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77)
- SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgf90 pgf77)
+ SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77)
SET(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90)
SET(_Fortran_COMPILER_NAMES_XL xlf)
SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index aed1fd2..76cf34e 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -109,6 +109,14 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG)
SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
ENDIF()
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+IF(NOT CMAKE_MODULE_EXISTS)
+ SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS})
+ SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS})
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
# repeat for modules
IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 2cc27cf..e0a5518 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -1,5 +1,7 @@
-# - Build binary and source package installers
-#
+##section Variables common to all CPack generators
+##end
+##module
+# - Build binary and source package installers.
# The CPack module generates binary and source installers in a variety
# of formats using the cpack program. Inclusion of the CPack module
# adds two new targets to the resulting makefiles, package and
@@ -29,16 +31,16 @@
# on a per-generator basis. It only need contain overrides.
#
# Here's how it works:
-# - cpack runs
-# - it includes CPackConfig.cmake
-# - it iterates over the generators listed in that file's
-# CPACK_GENERATOR list variable (unless told to use just a
-# specific one via -G on the command line...)
+# - cpack runs
+# - it includes CPackConfig.cmake
+# - it iterates over the generators listed in that file's
+# CPACK_GENERATOR list variable (unless told to use just a
+# specific one via -G on the command line...)
#
-# - foreach generator, it then
-# - sets CPACK_GENERATOR to the one currently being iterated
-# - includes the CPACK_PROJECT_CONFIG_FILE
-# - produces the package for that generator
+# - foreach generator, it then
+# - sets CPACK_GENERATOR to the one currently being iterated
+# - includes the CPACK_PROJECT_CONFIG_FILE
+# - produces the package for that generator
#
# This is the key: For each generator listed in CPACK_GENERATOR
# in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
@@ -48,174 +50,180 @@
# Before including this CPack module in your CMakeLists.txt file,
# there are a variety of variables that can be set to customize
# the resulting installers. The most commonly-used variables are:
+##end
#
+##variable
# CPACK_PACKAGE_NAME - The name of the package (or application). If
# not specified, defaults to the project name.
+##end
#
-# CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g.,
+##variable
+# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g.,
# "Kitware").
+##end
#
+##variable
# CPACK_PACKAGE_VERSION_MAJOR - Package major Version
+##end
#
+##variable
# CPACK_PACKAGE_VERSION_MINOR - Package minor Version
+##end
#
+##variable
# CPACK_PACKAGE_VERSION_PATCH - Package patch Version
+##end
#
+##variable
# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
# project. Used, for example, the introduction screen of a
# CPack-generated Windows installer to describe the project.
+##end
#
+##variable
# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
# project (only a few words).
+##end
#
+##variable
# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
# not including the extension. For example, cmake-2.6.1-Linux-i686.
+##end
#
+##variable
# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
# target system, e.g., "CMake 2.5".
+##end
#
+##variable
# CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per
# generator after setting CPACK_GENERATOR to the actual generator
# being used. Allows per-generator setting of CPACK_* variables at
# cpack time.
+##end
#
+##variable
# CPACK_RESOURCE_FILE_LICENSE - License file for the project, which
# will typically be displayed to the user (often with an explicit
# "Accept" button, for graphical installers) prior to installation.
+##end
#
+##variable
# CPACK_RESOURCE_FILE_README - ReadMe file for the project, which
# typically describes in some detail
+##end
#
+##variable
# CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which
# welcomes users to this installer. Typically used in the graphical
# installers on Windows and Mac OS X.
+##end
#
+##variable
# CPACK_MONOLITHIC_INSTALL - Disables the component-based
# installation mechanism, so that all components are always installed.
+##end
#
+##variable
# CPACK_GENERATOR - List of CPack generators to use. If not
# specified, CPack will create a set of options (e.g.,
# CPACK_BINARY_NSIS) allowing the user to enable/disable individual
# generators.
+##end
#
+##variable
# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file
# for binary installers that will be generated by the CPack
# module. Defaults to CPackConfig.cmake.
+##end
#
+##variable
# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along
# with a text label, to be used to create Start Menu shortcuts on
# Windows. For example, setting this to the list ccmake;CMake will
# create a shortcut named "CMake" that will execute the installed
# executable ccmake.
+##end
#
+##variable
# CPACK_STRIP_FILES - List of files to be stripped. Starting with
# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
# enables stripping of all files (a list of files evaluates to TRUE
# in CMake, so this change is compatible).
+##end
#
# The following CPack variables are specific to source packages, and
# will not affect binary packages:
#
+##variable
# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package,
# e.g., cmake-2.6.1
+##end
#
+##variable
# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
# will be stripped. Starting with CMake 2.6.0
# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
# stripping of all files (a list of files evaluates to TRUE in CMake,
# so this change is compatible).
+##end
#
+##variable
# CPACK_SOURCE_GENERATOR - List of generators used for the source
# packages. As with CPACK_GENERATOR, if this is not specified then
# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
# allowing users to select which packages will be generated.
+##end
#
+##variable
# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack
# configuration file for source installers that will be generated by
# the CPack module. Defaults to CPackSourceConfig.cmake.
+##end
#
+##variable
# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
# that won't be packaged when building a source package. This is a
# list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
-#
-# The following variables are specific to the DragNDrop installers
-# built on Mac OS X:
-#
-# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk
-# image. Defaults to CPACK_PACKAGE_FILE_NAME.
-#
-# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO
-# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF
-# bzip2-compressed). Refer to hdiutil(1) for more information on
-# other available formats.
-#
-# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g.
-# can be used to specify the Finder window position/geometry and
-# layout (such as hidden toolbars, placement of the icons etc.).
-# This file has to be generated by the Finder (either manually or
-# through OSA-script) using a normal folder from which the .DS_Store
-# file can then be extracted.
-#
-# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be
-# used as the background for the Finder Window when the disk image
-# is opened. By default no background image is set. The background
-# image is applied after applying the custom .DS_Store file.
-#
-# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to
-# operate on disk image files on Mac OS X. This variable can be used
-# to override the automatically detected command (or specify its
-# location if the auto-detection fails to find it.)
-#
-# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set
-# extended attributes on files and directories on Mac OS X. This
-# variable can be used to override the automatically detected
-# command (or specify its location if the auto-detection fails to
-# find it.)
-#
-# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile
-# resources on Mac OS X. This variable can be used to override the
-# automatically detected command (or specify its location if the
-# auto-detection fails to find it.)
-#
-# The following variable is specific to installers build on Mac OS X
-# using PackageMaker:
-#
-# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the
-# resulting PackageMaker archive should be compatible
-# with. Different versions of Mac OS X support different
-# features. For example, CPack can only build component-based
-# installers for Mac OS X 10.4 or newer, and can only build
-# installers that download component son-the-fly for Mac OS X 10.5
-# or newer. If left blank, this value will be set to the minimum
-# version of Mac OS X that supports the requested features. Set this
-# variable to some value (e.g., 10.4) only if you want to guarantee
-# that your installer will work on that version of Mac OS X, and
-# don't mind missing extra features available in the installer
-# shipping with later versions of Mac OS X.
+##end
#
# The following variables are for advanced uses of CPack:
#
+##variable
# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
# project is CMake project. Defaults to the value of CMAKE_GENERATOR;
# few users will want to change this setting.
+##end
#
+##variable
# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
# what project to install. The four values are: Build directory,
# Project Name, Project Component, Directory. If omitted, CPack will
# build an installer that installers everything.
+##end
#
+##variable
# CPACK_SYSTEM_NAME - System name, defaults to the value of
# ${CMAKE_SYSTEM_NAME}.
+##end
#
+##variable
# CPACK_PACKAGE_VERSION - Package full version, used internally. By
# default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
+##end
#
+##variable
# CPACK_TOPLEVEL_TAG - Directory for the installed files.
+##end
#
+##variable
# CPACK_INSTALL_COMMANDS - Extra commands to install components.
+##end
#
+##variable
# CPACK_INSTALLED_DIRECTORIES - Extra directories to install.
+##end
#
#=============================================================================
@@ -259,7 +267,7 @@ MACRO(cpack_set_if_not_set name value)
ENDIF(NOT DEFINED "${name}")
ENDMACRO(cpack_set_if_not_set)
-# Macro to encode variables for the configuration file
+# cpack_encode_variables - Macro to encode variables for the configuration file
# find any variable that starts with CPACK and create a variable
# _CPACK_OTHER_VARIABLES_ that contains SET commands for
# each cpack variable. _CPACK_OTHER_VARIABLES_ is then
diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake
index 3ac4ea8..007fc04 100644
--- a/Modules/CPackBundle.cmake
+++ b/Modules/CPackBundle.cmake
@@ -1,25 +1,37 @@
+##section Variables specific to CPack Bundle generator
+##end
+##module
# - CPack Bundle generator (Mac OS X) specific options
#
# Installers built on Mac OS X using the Bundle generator use the
# aforementioned DragNDrop variables, plus the following Bundle-specific
# parameters:
+##end
#
+##variable
# CPACK_BUNDLE_NAME - The name of the generated bundle. This
# appears in the OSX finder as the bundle name. Required.
+##end
#
+##variable
# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used
# as the Info.plist for the generated bundle. This assumes that
# the caller has generated or specified their own Info.plist file.
# Required.
+##end
#
+##variable
# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as
# the icon for the generated bundle. This is the icon that appears
# in the OSX finder for the bundle, and in the OSX dock when the
# bundle is opened. Required.
+##end
#
+##variable
# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that
# will be run whenever an end-user double-clicks the generated bundle
# in the OSX Finder. Optional.
+##end
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 1c10372..1598703 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -1,3 +1,6 @@
+##section Variables concerning CPack Components
+##end
+##module
# - Build binary and source package installers
#
# The CPackComponent module is the module which handles
@@ -20,7 +23,54 @@
# components are identified by the COMPONENT argument of CMake's
# INSTALL commands, and should be further described by the following
# CPack commands:
-#
+##end
+#
+##variable
+# CPACK_COMPONENTS_ALL - The list of component to install.
+#
+# The default value of this variable is computed by CPack
+# and contains all components defined by the project. The
+# user may set it to only include the specified components.
+##end
+#
+##variable
+# CPACK_<GENNAME>_COMPONENT_INSTALL - Enable/Disable component install for
+# CPack generator <GENNAME>.
+#
+# Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy
+# default behavior. e.g. RPM builds monolithic whereas NSIS builds component.
+# One can change the default behavior by setting this variable to 0/1 or OFF/ON.
+##end
+##variable
+# CPACK_COMPONENTS_GROUPING - Specify how components are grouped for multi-package
+# component-aware CPack generators.
+#
+# Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several
+# packages files when asked for component packaging. They group the component
+# differently depending on the value of this variable:
+# - ONE_PER_GROUP (default): creates one package file per component group
+# - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component
+# - IGNORE : creates one package per component, i.e. IGNORE component group
+# One can specify different grouping for different CPack generator by using
+# a CPACK_PROJECT_CONFIG_FILE.
+##end
+##variable
+# CPACK_COMPONENT_<compName>_DISPLAY_NAME - The name to be displayed for a component.
+##end
+##variable
+# CPACK_COMPONENT_<compName>_DESCRIPTION - The description of a component.
+##end
+##variable
+# CPACK_COMPONENT_<compName>_GROUP - The group of a component.
+##end
+##variable
+# CPACK_COMPONENT_<compName>_DEPENDS - The dependencies (list of components)
+# on which this component depends.
+##end
+##variable
+# CPACK_COMPONENT_<compName>_REQUIRED - True is this component is required.
+##end
+##macro
# cpack_add_component - Describes a CPack installation component
# named by the COMPONENT argument to a CMake INSTALL command.
#
@@ -90,7 +140,9 @@
# create a file with some name based on CPACK_PACKAGE_FILE_NAME and
# the name of the component. See cpack_configure_downloads for more
# information.
+##end
#
+##macro
# cpack_add_component_group - Describes a group of related CPack
# installation components.
#
@@ -134,7 +186,9 @@
#
# BOLD_TITLE indicates that the group title should appear in bold,
# to call the user's attention to the group.
+##end
#
+##macro
# cpack_add_install_type - Add a new installation type containing a
# set of predefined component selections to the graphical installer.
#
@@ -153,7 +207,9 @@
# DISPLAY_NAME is the displayed name of the install type, which will
# typically show up in a drop-down box within a graphical
# installer. This value can be any string.
+##end
#
+##macro
# cpack_configure_downloads - Configure CPack to download selected
# components on-the-fly as part of the installation process.
#
@@ -203,6 +259,7 @@
# that can be called from Windows' Add/Remove Programs dialog (via the
# "Modify" button) to change the set of installed components. NO_ADD_REMOVE
# turns off this behavior. This option is ignored on Mac OS X.
+##endmacro
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
new file mode 100644
index 0000000..caa8dc8
--- /dev/null
+++ b/Modules/CPackDMG.cmake
@@ -0,0 +1,70 @@
+##section Variables specific to CPack DragNDrop generator
+##end
+##module
+# - DragNDrop CPack generator (Mac OS X).
+# The following variables are specific to the DragNDrop installers
+# built on Mac OS X:
+##end
+#
+##variable
+# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk
+# image. Defaults to CPACK_PACKAGE_FILE_NAME.
+##end
+#
+##variable
+# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO
+# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF
+# bzip2-compressed). Refer to hdiutil(1) for more information on
+# other available formats.
+##end
+#
+##variable
+# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g.
+# can be used to specify the Finder window position/geometry and
+# layout (such as hidden toolbars, placement of the icons etc.).
+# This file has to be generated by the Finder (either manually or
+# through OSA-script) using a normal folder from which the .DS_Store
+# file can then be extracted.
+##end
+#
+##variable
+# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be
+# used as the background for the Finder Window when the disk image
+# is opened. By default no background image is set. The background
+# image is applied after applying the custom .DS_Store file.
+##end
+#
+##variable
+# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to
+# operate on disk image files on Mac OS X. This variable can be used
+# to override the automatically detected command (or specify its
+# location if the auto-detection fails to find it.)
+##end
+#
+##variable
+# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set
+# extended attributes on files and directories on Mac OS X. This
+# variable can be used to override the automatically detected
+# command (or specify its location if the auto-detection fails to
+# find it.)
+##end
+#
+##variable
+# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile
+# resources on Mac OS X. This variable can be used to override the
+# automatically detected command (or specify its location if the
+# auto-detection fails to find it.)
+##end
+
+#=============================================================================
+# Copyright 2006-2012 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 26433bb..fe81dc9 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -1,3 +1,6 @@
+##section Variables specific to CPack Debian (DEB) generator
+##end
+##module
# - The builtin (binary) CPack Deb generator (Unix only)
# CPackDeb may be used to create Deb package using CPack.
# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
@@ -11,43 +14,63 @@
# the wiki:
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
# However as a handy reminder here comes the list of specific variables:
+##end
#
+##variable
# CPACK_DEBIAN_PACKAGE_NAME
# Mandatory : YES
# Default : CPACK_PACKAGE_NAME (lower case)
# The debian package summary
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_VERSION
# Mandatory : YES
# Default : CPACK_PACKAGE_VERSION
# The debian package version
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_ARCHITECTURE
# Mandatory : YES
# Default : Output of dpkg --print-architecture (or i386 if dpkg is not found)
# The debian package architecture
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_DEPENDS
# Mandatory : NO
# Default : -
# May be used to set deb dependencies.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_MAINTAINER
# Mandatory : YES
# Default : CPACK_PACKAGE_CONTACT
# The debian package maintainer
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_DESCRIPTION
# Mandatory : YES
# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
# The debian package description
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_SECTION
# Mandatory : YES
# Default : 'devel'
# The debian package section
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_PRIORITY
# Mandatory : YES
# Default : 'optional'
# The debian package priority
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_HOMEPAGE
# Mandatory : NO
# Default : -
# The URL of the web site for this package
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_SHLIBDEPS
# Mandatory : NO
# Default : OFF
@@ -57,11 +80,15 @@
# if you use this feature, because if you don't dpkg-shlibdeps
# may fail to find your own shared libs.
# See http://www.cmake.org/Wiki/CMake_RPATH_handling.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_DEBUG
# Mandatory : NO
# Default : -
# May be set when invoking cpack in order to trace debug information
# during CPackDeb run.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_PREDEPENDS
# Mandatory : NO
# Default : -
@@ -69,12 +96,16 @@
# This field is like Depends, except that it also forces dpkg to complete installation of
# the packages named before even starting the installation of the package which declares
# the pre-dependency.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_ENHANCES
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# This field is similar to Suggests but works in the opposite direction.
# It is used to declare that a package can enhance the functionality of another package.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_BREAKS
# Mandatory : NO
# Default : -
@@ -82,23 +113,30 @@
# When one binary package declares that it breaks another, dpkg will refuse to allow the
# package which declares Breaks be installed unless the broken package is deconfigured first,
# and it will refuse to allow the broken package to be reconfigured.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_CONFLICTS
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# When one binary package declares a conflict with another using a Conflicts field,
# dpkg will refuse to allow them to be installed on the system at the same time.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_PROVIDES
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# A virtual package is one which appears in the Provides control field of another package.
+##end
+##variable
# CPACK_DEBIAN_PACKAGE_REPLACES
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# Packages can declare in their control file that they should overwrite
# files in certain other packages, or completely replace other packages.
+##end
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake
index d9dab53..97179d7 100644
--- a/Modules/CPackNSIS.cmake
+++ b/Modules/CPackNSIS.cmake
@@ -1,70 +1,112 @@
+##section Variables specific to CPack NSIS generator
+##end
+##module
# - CPack NSIS generator specific options
#
# The following variables are specific to the graphical installers built
# on Windows using the Nullsoft Installation System.
+##end
#
+##variable
# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
# installing this project.
+##end
#
+##variable
# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented
# to the end user by the NSIS installer is under this root dir. The full
# directory presented to the end user is:
# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
+##end
#
+##variable
# CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated
# install program.
+##end
#
+##variable
# CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated
# uninstall program.
+##end
#
+##variable
# CPACK_PACKAGE_ICON - A branding image that will be displayed inside
# the installer.
+##end
#
+##variable
# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will
# be added to the install Section.
+##end
#
+##variable
# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will
# be added to the uninstall Section.
+##end
#
+##variable
# CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the
# NSIS SetCompressor command.
+##end
#
+##variable
# CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page
# will appear in the installer that will allow the user to choose
# whether the program directory should be added to the system PATH
# variable.
+##end
#
+##variable
# CPACK_NSIS_DISPLAY_NAME - The display name string that appears in
# the Windows Add/Remove Program control panel
+##end
#
+##variable
# CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the
# installer.
+##end
#
+##variable
# CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that
# contains the installer icon.
+##end
#
+##variable
# CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in
# installing your application.
+##end
#
+##variable
# CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more
# information about your application.
+##end
#
+##variable
# CPACK_NSIS_CONTACT - Contact information for questions and comments
# about the installation process.
+##end
#
+##variable
# CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for
# creating start menu shortcuts.
+##end
#
+##variable
# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to
# uninstall start menu shortcuts.
+##end
#
+##variable
# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links
# assumes that they are in 'bin' unless this variable is set.
# For example, you would set this to 'exec' if your executables are
# in an exec directory.
+##end
#
+##variable
# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option
# to run on the finish page of the NSIS installer.
+##end
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake
new file mode 100644
index 0000000..8fe423c
--- /dev/null
+++ b/Modules/CPackPackageMaker.cmake
@@ -0,0 +1,34 @@
+##section Variables specific to CPack PackageMaker generator
+##end
+##module
+# - PackageMaker CPack generator (Mac OS X).
+# The following variable is specific to installers build on Mac OS X
+# using PackageMaker:
+#
+##variable
+# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the
+# resulting PackageMaker archive should be compatible
+# with. Different versions of Mac OS X support different
+# features. For example, CPack can only build component-based
+# installers for Mac OS X 10.4 or newer, and can only build
+# installers that download component son-the-fly for Mac OS X 10.5
+# or newer. If left blank, this value will be set to the minimum
+# version of Mac OS X that supports the requested features. Set this
+# variable to some value (e.g., 10.4) only if you want to guarantee
+# that your installer will work on that version of Mac OS X, and
+# don't mind missing extra features available in the installer
+# shipping with later versions of Mac OS X.
+##end
+
+#=============================================================================
+# Copyright 2006-2012 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index e1e76ed..442d7c4 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -1,3 +1,6 @@
+##section Variables specific to CPack RPM generator
+##end
+##module
# - The builtin (binary) CPack RPM generator (Unix only)
# CPackRPM may be used to create RPM package using CPack.
# CPackRPM is a CPack generator thus it uses the CPACK_XXX variables
@@ -15,52 +18,67 @@
# You'll find a detailed usage of CPackRPM on the wiki:
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
# However as a handy reminder here comes the list of specific variables:
+##end
#
-# CPACK_RPM_PACKAGE_SUMMARY
+##variable
+# CPACK_RPM_PACKAGE_SUMMARY - The RPM package summary.
# Mandatory : YES
# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
-# The RPM package summary
-# CPACK_RPM_PACKAGE_NAME
+##end
+##variable
+# CPACK_RPM_PACKAGE_NAME - The RPM package name.
# Mandatory : YES
# Default : CPACK_PACKAGE_NAME
-# The RPM package name
-# CPACK_RPM_PACKAGE_VERSION
+##end
+##variable
+# CPACK_RPM_PACKAGE_VERSION - The RPM package version.
# Mandatory : YES
# Default : CPACK_PACKAGE_VERSION
-# The RPM package version
-# CPACK_RPM_PACKAGE_ARCHITECTURE
+##end
+##variable
+# CPACK_RPM_PACKAGE_ARCHITECTURE - The RPM package architecture.
# Mandatory : NO
# Default : -
-# The RPM package architecture. This may be set to "noarch" if you
+# This may be set to "noarch" if you
# know you are building a noarch package.
-# CPACK_RPM_PACKAGE_RELEASE
+##end
+##variable
+# CPACK_RPM_PACKAGE_RELEASE - The RPM package release.
# Mandatory : YES
# Default : 1
-# The RPM package release. This is the numbering of the RPM package
+# This is the numbering of the RPM package
# itself, i.e. the version of the packaging and not the version of the
# content (see CPACK_RPM_PACKAGE_VERSION). One may change the default
# value if the previous packaging was buggy and/or you want to put here
# a fancy Linux distro specific numbering.
-# CPACK_RPM_PACKAGE_LICENSE
+##end
+##variable
+# CPACK_RPM_PACKAGE_LICENSE - The RPM package license policy.
# Mandatory : YES
# Default : "unknown"
-# The RPM package license policy.
-# CPACK_RPM_PACKAGE_GROUP
+##end
+##variable
+# CPACK_RPM_PACKAGE_GROUP - The RPM package group.
# Mandatory : YES
# Default : "unknown"
-# The RPM package group.
-# CPACK_RPM_PACKAGE_VENDOR
+##end
+##variable
+# CPACK_RPM_PACKAGE_VENDOR - The RPM package vendor.
# Mandatory : YES
# Default : CPACK_PACKAGE_VENDOR if set or "unknown"
-# The RPM package vendor.
-# CPACK_RPM_PACKAGE_URL
+##end
+##variable
+# CPACK_RPM_PACKAGE_URL - The projects URL.
# Mandatory : NO
# Default : -
-# The projects URL.
-# CPACK_RPM_PACKAGE_DESCRIPTION
+##end
+##variable
+# CPACK_RPM_PACKAGE_DESCRIPTION - RPM package description.
# Mandatory : YES
# Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available"
-# CPACK_RPM_COMPRESSION_TYPE
+##end
+##variable
+# CPACK_RPM_COMPRESSION_TYPE - RPM compression type.
# Mandatory : NO
# Default : -
# May be used to override RPM compression type to be used
@@ -68,7 +86,9 @@
# to lzma or xz compression whereas older cannot use such RPM.
# Using this one can enforce compression type to be used.
# Possible value are: lzma, xz, bzip2 and gzip.
-# CPACK_RPM_PACKAGE_REQUIRES
+##end
+##variable
+# CPACK_RPM_PACKAGE_REQUIRES - RPM spec requires field.
# Mandatory : NO
# Default : -
# May be used to set RPM dependencies (requires).
@@ -77,22 +97,30 @@
# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
# The required package list of an RPM file could be printed with
# rpm -qp --requires file.rpm
-# CPACK_RPM_PACKAGE_SUGGESTS
+##end
+##variable
+# CPACK_RPM_PACKAGE_SUGGESTS - RPM spec suggest field.
# Mandatory : NO
# Default : -
# May be used to set weak RPM dependencies (suggests).
# Note that you must enclose the complete requires string between quotes.
-# CPACK_RPM_PACKAGE_PROVIDES
+##end
+##variable
+# CPACK_RPM_PACKAGE_PROVIDES - RPM spec provides field.
# Mandatory : NO
# Default : -
# May be used to set RPM dependencies (provides).
# The provided package list of an RPM file could be printed with
# rpm -qp --provides file.rpm
-# CPACK_RPM_PACKAGE_OBSOLETES
+##end
+##variable
+# CPACK_RPM_PACKAGE_OBSOLETES - RPM spec obsoletes field.
# Mandatory : NO
# Default : -
# May be used to set RPM packages that are obsoleted by this one.
-# CPACK_RPM_PACKAGE_RELOCATABLE
+##end
+##variable
+# CPACK_RPM_PACKAGE_RELOCATABLE - build a relocatable RPM.
# Mandatory : NO
# Default : CPACK_PACKAGE_RELOCATABLE
# If this variable is set to TRUE or ON CPackRPM will try
@@ -103,7 +131,9 @@
# If CPACK_SET_DESTDIR is set then you will get a warning message
# but if there is file installed with absolute path you'll get
# unexpected behavior.
-# CPACK_RPM_SPEC_INSTALL_POST [deprecated]
+##end
+##variable
+# CPACK_RPM_SPEC_INSTALL_POST - [deprecated].
# Mandatory : NO
# Default : -
# This way of specifying post-install script is deprecated use
@@ -111,23 +141,31 @@
# May be used to set an RPM post-install command inside the spec file.
# For example setting it to "/bin/true" may be used to prevent
# rpmbuild to strip binaries.
-# CPACK_RPM_SPEC_MORE_DEFINE
+##end
+##variable
+# CPACK_RPM_SPEC_MORE_DEFINE - RPM extended spec definitions lines.
# Mandatory : NO
# Default : -
# May be used to add any %define lines to the generated spec file.
-# CPACK_RPM_PACKAGE_DEBUG
+##end
+##variable
+# CPACK_RPM_PACKAGE_DEBUG - Toggle CPackRPM debug output.
# Mandatory : NO
# Default : -
# May be set when invoking cpack in order to trace debug information
# during CPack RPM run. For example you may launch CPack like this
# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
-# CPACK_RPM_USER_BINARY_SPECFILE
+##end
+##variable
+# CPACK_RPM_USER_BINARY_SPECFILE - A user provided spec file.
# Mandatory : NO
# Default : -
# May be set by the user in order to specify a USER binary spec file
# to be used by CPackRPM instead of generating the file.
# The specified file will be processed by CONFIGURE_FILE( @ONLY).
-# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
+##end
+##variable
+# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template.
# Mandatory : NO
# Default : -
# If set CPack will generate a template for USER specified binary
@@ -135,6 +173,8 @@
# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
# The user may then use this file in order to hand-craft is own
# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE.
+##end
+##variable
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
# Mandatory : NO
@@ -143,11 +183,13 @@
# The refered script file(s) will be read and directly
# put after the %pre or %preun section
# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
-# each component can be overriden with
+# each component can be overridden with
# CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE and
# CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE
# One may verify which scriptlet has been included with
# rpm -qp --scripts package.rpm
+##end
+##variable
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
# Mandatory : NO
@@ -156,26 +198,31 @@
# The refered script file(s) will be read and directly
# put after the %post or %postun section
# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
-# each component can be overriden with
+# each component can be overridden with
# CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE and
# CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE
# One may verify which scriptlet has been included with
# rpm -qp --scripts package.rpm
+##end
+##variable
# CPACK_RPM_USER_FILELIST
# CPACK_RPM_<COMPONENT>_USER_FILELIST
# Mandatory : NO
# Default : -
-# May be used to explicitely specify %(<directive>) file line
+# May be used to explicitly specify %(<directive>) file line
# in the spec file. Like %config(noreplace) or any other directive
# that be found in the %files section. Since CPackRPM is generating
# the list of files (and directories) the user specified files of
# the CPACK_RPM_<COMPONENT>_USER_FILELIST list will be removed from the generated list.
-# CPACK_RPM_CHANGELOG_FILE
+##end
+##variable
+# CPACK_RPM_CHANGELOG_FILE - RPM changelog file.
# Mandatory : NO
# Default : -
# May be used to embed a changelog in the spec file.
# The refered file will be read and directly put after the %changelog
# section.
+##end
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index 5380f4d..3618bdf 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -9,6 +9,7 @@
#=============================================================================
# Copyright 2006-2011 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2011 Matthias Kretz <kretz@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -35,6 +36,7 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
+ FAIL_REGEX "WARNING: unknown flag:" # Open64
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_C_COMPILER_FLAG)
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index 3da04b4..134f875 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -9,6 +9,7 @@
#=============================================================================
# Copyright 2006-2010 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2011 Matthias Kretz <kretz@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -27,6 +28,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
# Some compilers do not fail with a bad flag
+ FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
FAIL_REGEX "unrecognized .*option" # GNU
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "ignoring unknown option" # MSVC
@@ -36,6 +38,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
FAIL_REGEX "command option .* is not recognized" # XL
FAIL_REGEX "not supported in this configuration; ignored" # AIX
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
+ FAIL_REGEX "WARNING: unknown flag:" # Open64
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_CXX_COMPILER_FLAG)
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 75b5ca1..642d962 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -44,7 +44,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY IMMEDIATE)
- MESSAGE(STATUS "Looking for include files ${VARIABLE}")
+ MESSAGE(STATUS "Looking for include files ${INCLUDE}")
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
@@ -54,15 +54,15 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
- MESSAGE(STATUS "Looking for include files ${VARIABLE} - found")
- SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${VARIABLE}")
+ MESSAGE(STATUS "Looking for include files ${INCLUDE} - found")
+ SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if files ${INCLUDE} "
"exist passed with the following output:\n"
"${OUTPUT}\n\n")
ELSE(${VARIABLE})
- MESSAGE(STATUS "Looking for include files ${VARIABLE} - not found.")
- SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${VARIABLE}")
+ MESSAGE(STATUS "Looking for include files ${INCLUDE} - not found.")
+ SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if files ${INCLUDE} "
"exist failed with the following output:\n"
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
new file mode 100644
index 0000000..87a4018
--- /dev/null
+++ b/Modules/CheckLanguage.cmake
@@ -0,0 +1,65 @@
+# - Check if a language can be enabled
+# Usage:
+# check_language(<lang>)
+# where <lang> is a language that may be passed to enable_language()
+# such as "Fortran". If CMAKE_<lang>_COMPILER is already defined the
+# check does nothing. Otherwise it tries enabling the language in a
+# test project. The result is cached in CMAKE_<lang>_COMPILER as the
+# compiler that was found, or NOTFOUND if the language cannot be enabled.
+#
+# Example:
+# check_language(Fortran)
+# if(CMAKE_Fortran_COMPILER)
+# enable_language(Fortran)
+# else()
+# message(STATUS "No Fortran support")
+# endif()
+
+#=============================================================================
+# Copyright 2009-2012 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+macro(check_language lang)
+ if(NOT DEFINED CMAKE_${lang}_COMPILER)
+ set(_desc "Looking for a ${lang} compiler")
+ message(STATUS ${_desc})
+ file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
+ "cmake_minimum_required(VERSION 2.8)
+project(Check${lang} ${lang})
+file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
+ \"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
+ )
+")
+ execute_process(
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
+ COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ )
+ include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL)
+ if(CMAKE_${lang}_COMPILER AND "${result}" STREQUAL "0")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "${_desc} passed with the following output:\n"
+ "${output}\n")
+ else()
+ set(CMAKE_${lang}_COMPILER NOTFOUND)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${_desc} failed with the following output:\n"
+ "${output}\n")
+ endif()
+ message(STATUS "${_desc} - ${CMAKE_${lang}_COMPILER}")
+ set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler")
+ mark_as_advanced(CMAKE_${lang}_COMPILER)
+ endif()
+endmacro()
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index eb10cbc..cef647e 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -125,7 +125,7 @@
#
# set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED
# PURPOSE "Enables HTML-import in MyWordProcessor")
-# ...
+# ...
# set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL
# PURPOSE "Enables odt-export in MyWordProcessor")
#
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index af84f8c..4a0b693 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -8,11 +8,12 @@
#
# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
# ALSA_LIBRARY - the asound library
+# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)
#
#=============================================================================
-# Copyright 2009 Kitware, Inc.
-# Copyright 2009 Philip Lowman <philip@yhbt.com>
+# Copyright 2009-2011 Kitware, Inc.
+# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -24,8 +25,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_path(ALSA_INCLUDE_DIR NAMES asoundlib.h
- PATH_SUFFIXES alsa
+find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
DOC "The ALSA (asound) include directory"
)
@@ -33,10 +33,19 @@ find_library(ALSA_LIBRARY NAMES asound
DOC "The ALSA (asound) library"
)
+if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
+ file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")
+
+ string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
+ unset(alsa_version_str)
+endif()
+
# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA DEFAULT_MSG ALSA_LIBRARY ALSA_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
+ REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
+ VERSION_VAR ALSA_VERSION_STRING)
if(ALSA_FOUND)
set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index edde9eb..7af3367 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -75,8 +75,9 @@ IF(BISON_EXECUTABLE)
ELSEIF("${BISON_version_output}" MATCHES "^bison[^+]")
STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
BISON_VERSION "${BISON_version_output}")
- ELSE()
- SET(BISON_VERSION "unknown")
+ ELSEIF("${BISON_version_output}" MATCHES "^GNU Bison ")
+ STRING(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2"
+ BISON_VERSION "${BISON_version_output}")
ENDIF()
ENDIF()
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 9b76d90..9eadfd1 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -23,6 +23,7 @@
##########
### List of vendors (BLA_VENDOR) valid in this module
## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
+## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model),
## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
# C/CXX should be enabled to use Intel mkl
@@ -85,6 +86,7 @@ if (NOT _libdir)
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
endif ()
endif ()
+
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
@@ -115,7 +117,7 @@ foreach(_library ${_list})
endforeach(_library ${_list})
if(_libraries_work)
# Test this combination of libraries.
- set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
if (_CHECK_FORTRAN)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
@@ -460,117 +462,99 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
find_package(Threads REQUIRED)
endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
- if (WIN32)
+
+ set(BLAS_SEARCH_LIBS "")
+
if(BLA_F95)
- if(NOT BLAS95_LIBRARIES)
- check_fortran_libraries(
- BLAS95_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
- ""
- )
- endif(NOT BLAS95_LIBRARIES)
- else(BLA_F95)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- SGEMM
- ""
- "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
- endif(BLA_F95)
- else(WIN32)
- if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- if(BLA_F95)
- if(NOT BLAS95_LIBRARIES)
- check_fortran_libraries(
- BLAS95_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif(NOT BLAS95_LIBRARIES)
- else(BLA_F95)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_intel;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- "${LM}"
- )
- endif(NOT BLAS_LIBRARIES)
- endif(BLA_F95)
- endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- if(BLA_F95)
- if(NOT BLAS95_LIBRARIES)
- check_fortran_libraries(
- BLAS95_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif(NOT BLAS95_LIBRARIES)
- else(BLA_F95)
- if(NOT BLAS_LIBRARIES)
+ set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
+ set(_LIBRARIES BLAS95_LIBRARIES)
+ if (WIN32)
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40")
+ else (WIN32)
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+
+ # mkl >= 10.3
+ if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")
+ set(LM "${LM};-lgomp")
+ else ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
+ endif ()
+ endif ()
+ endif (WIN32)
+ if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core")
+ endif ()
+ else (BLA_F95)
+ set(BLAS_mkl_SEARCH_SYMBOL sgemm)
+ set(_LIBRARIES BLAS_LIBRARIES)
+ if (WIN32)
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40")
+ else (WIN32)
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel mkl_intel_thread mkl_core guide")
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+
+ # mkl >= 10.3
+ if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_gnu_thread mkl_core")
+ set(LM "${LM};-lgomp")
+ else ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
+ endif ()
+ endif ()
+
+ #older vesions of intel mkl libs
+ if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_ia32")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_em64t")
+ endif ()
+ endif (WIN32)
+ if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_sequential mkl_core")
+ endif ()
+ endif (BLA_F95)
+
+ foreach (IT ${BLAS_SEARCH_LIBS})
+ string(REPLACE " " ";" SEARCH_LIBS ${IT})
+ if (${_LIBRARIES})
+ else ()
check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif(NOT BLAS_LIBRARIES)
- endif(BLA_F95)
- endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- endif (WIN32)
- #older vesions of intel mkl libs
- # BLAS in intel mkl library? (shared)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl;guide"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif(NOT BLAS_LIBRARIES)
- #BLAS in intel mkl library? (static, 32bit)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_ia32;guide"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif(NOT BLAS_LIBRARIES)
- #BLAS in intel mkl library? (static, em64t 64bit)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_em64t;guide"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif(NOT BLAS_LIBRARIES)
+ ${_LIBRARIES}
+ BLAS
+ ${BLAS_mkl_SEARCH_SYMBOL}
+ ""
+ "${SEARCH_LIBS}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif ()
+ endforeach ()
+
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 679c129..7130192 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -5,10 +5,12 @@
# BZIP2_INCLUDE_DIR - the BZip2 include directory
# BZIP2_LIBRARIES - Link these to use BZip2
# BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_
+# BZIP2_VERSION_STRING - the version of BZip2 found (since CMake 2.8.8)
#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006-2012 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -22,17 +24,29 @@
FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
-FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
+IF (NOT BZIP2_LIBRARIES)
+ FIND_LIBRARY(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 )
+ FIND_LIBRARY(BZIP2_LIBRARY_DEBUG NAMES bzip2d )
+
+ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
+ENDIF (NOT BZIP2_LIBRARIES)
+
+IF (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
+ FILE(STRINGS "${BZIP2_INCLUDE_DIR}/bzlib.h" BZLIB_H REGEX "bzip2/libbzip2 version [0-9]+\\.[^ ]+ of [0-9]+ ")
+ STRING(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}")
+ENDIF (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 DEFAULT_MSG BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
+ REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR
+ VERSION_VAR BZIP2_VERSION_STRING)
IF (BZIP2_FOUND)
INCLUDE(CheckLibraryExists)
- CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+ CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
ENDIF (BZIP2_FOUND)
-MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)
-
+MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 4d91a92..9f8d575 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -906,7 +906,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.")
endif()
- # Set up all the command line flags here, so that they can be overriden on a per target basis.
+ # Set up all the command line flags here, so that they can be overridden on a per target basis.
set(nvcc_flags "")
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 36f3841..cc00d53 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -1,12 +1,14 @@
# - Find curl
# Find the native CURL headers and libraries.
#
-# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
-# CURL_LIBRARIES - List of libraries when using curl.
-# CURL_FOUND - True if curl found.
+# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
+# CURL_LIBRARIES - List of libraries when using curl.
+# CURL_FOUND - True if curl found.
+# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -32,10 +34,24 @@ FIND_LIBRARY(CURL_LIBRARY NAMES
)
MARK_AS_ADVANCED(CURL_LIBRARY)
+IF(CURL_INCLUDE_DIR)
+ FOREACH(_curl_version_header curlver.h curl.h)
+ IF(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
+ FILE(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
+
+ STRING(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
+ UNSET(curl_version_str)
+ BREAK()
+ ENDIF()
+ ENDFOREACH(_curl_version_header)
+ENDIF()
+
# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARY CURL_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
+ REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
+ VERSION_VAR CURL_VERSION_STRING)
IF(CURL_FOUND)
SET(CURL_LIBRARIES ${CURL_LIBRARY})
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 7e3e10a..3862f7d 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -4,12 +4,14 @@
# CUPS_FOUND - system has Cups
# CUPS_INCLUDE_DIR - the Cups include directory
# CUPS_LIBRARIES - Libraries needed to use Cups
+# CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8)
# Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
# features this function (i.e. at least 1.1.19)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -21,36 +23,47 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-INCLUDE(CheckLibraryExists)
+find_path(CUPS_INCLUDE_DIR cups/cups.h )
-FIND_PATH(CUPS_INCLUDE_DIR cups/cups.h )
+find_library(CUPS_LIBRARIES NAMES cups )
-FIND_LIBRARY(CUPS_LIBRARIES NAMES cups )
+if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+ include(CheckLibraryExists)
-IF (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
- SET(CUPS_FOUND TRUE)
+ # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
+ CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+endif (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
- # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
- CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
- IF (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE AND NOT CUPS_HAS_IPP_DELETE_ATTRIBUTE)
- SET(CUPS_FOUND FALSE)
- ENDIF (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE AND NOT CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
+ file(STRINGS "${CUPS_INCLUDE_DIR}/cups/cups.h" cups_version_str
+ REGEX "^#[\t ]*define[\t ]+CUPS_VERSION_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
-ELSE (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
- SET(CUPS_FOUND FALSE)
-ENDIF (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
+ unset(CUPS_VERSION_STRING)
+ foreach(VPART MAJOR MINOR PATCH)
+ foreach(VLINE ${cups_version_str})
+ if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}")
+ string(REGEX REPLACE "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1"
+ CUPS_VERSION_PART "${VLINE}")
+ if(CUPS_VERSION_STRING)
+ set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}")
+ else(CUPS_VERSION_STRING)
+ set(CUPS_VERSION_STRING "${CUPS_VERSION_PART}")
+ endif(CUPS_VERSION_STRING)
+ endif()
+ endforeach(VLINE)
+ endforeach(VPART)
+endif (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
-IF (CUPS_FOUND)
- IF (NOT Cups_FIND_QUIETLY)
- MESSAGE(STATUS "Found Cups: ${CUPS_LIBRARIES}")
- ENDIF (NOT Cups_FIND_QUIETLY)
-ELSE (CUPS_FOUND)
- SET(CUPS_LIBRARIES )
- IF (Cups_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could NOT find Cups")
- ENDIF (Cups_FIND_REQUIRED)
-ENDIF (CUPS_FOUND)
-
-
-MARK_AS_ADVANCED(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+if (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
+ REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR CUPS_HAS_IPP_DELETE_ATTRIBUTE
+ VERSION_VAR CUPS_VERSION_STRING)
+else (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
+ REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR
+ VERSION_VAR CUPS_VERSION_STRING)
+endif (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+mark_as_advanced(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 8551fd6..1bf0743 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -24,10 +24,32 @@ FIND_PATH(EXPAT_INCLUDE_DIR NAMES expat.h)
# Look for the library.
FIND_LIBRARY(EXPAT_LIBRARY NAMES expat libexpat)
+if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
+ file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str
+ REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$")
+
+ unset(EXPAT_VERSION_STRING)
+ foreach(VPART MAJOR MINOR MICRO)
+ foreach(VLINE ${expat_version_str})
+ if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION")
+ string(REGEX REPLACE "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$" "\\1"
+ EXPAT_VERSION_PART "${VLINE}")
+ if(EXPAT_VERSION_STRING)
+ set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}")
+ else(EXPAT_VERSION_STRING)
+ set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}")
+ endif(EXPAT_VERSION_STRING)
+ endif()
+ endforeach(VLINE)
+ endforeach(VPART)
+endif (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
+
# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT DEFAULT_MSG EXPAT_LIBRARY EXPAT_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
+ REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
+ VERSION_VAR EXPAT_VERSION_STRING)
# Copy the results to the output variables.
IF(EXPAT_FOUND)
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 6a70b40..586f77a 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -91,8 +91,12 @@ IF(FLEX_EXECUTABLE)
MESSAGE("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available")
ENDIF()
ELSE()
- STRING(REGEX REPLACE "^flex (.*)$" "\\1"
+ # older versions of flex printed "/full/path/to/executable version X.Y"
+ # newer versions use "basename(executable) X.Y"
+ GET_FILENAME_COMPONENT(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
+ STRING(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2"
FLEX_VERSION "${FLEX_version_output}")
+ UNSET(FLEX_EXE_NAME)
ENDIF()
#============================================================
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 6251805..e6f6702 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -3,6 +3,7 @@
# FREETYPE_LIBRARIES, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
+# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
# This is the concatenation of the paths:
# FREETYPE_INCLUDE_DIR_ft2build
# FREETYPE_INCLUDE_DIR_freetype2
@@ -77,10 +78,33 @@ IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
+IF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+ FILE(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str
+ REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
+
+ UNSET(FREETYPE_VERSION_STRING)
+ FOREACH(VPART MAJOR MINOR PATCH)
+ FOREACH(VLINE ${freetype_version_str})
+ IF(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
+ STRING(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
+ FREETYPE_VERSION_PART "${VLINE}")
+ IF(FREETYPE_VERSION_STRING)
+ SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
+ ELSE(FREETYPE_VERSION_STRING)
+ SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
+ ENDIF(FREETYPE_VERSION_STRING)
+ UNSET(FREETYPE_VERSION_PART)
+ ENDIF()
+ ENDFOREACH(VLINE)
+ ENDFOREACH(VPART)
+ENDIF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+
+
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
-
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype
+ REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS
+ VERSION_VAR FREETYPE_VERSION_STRING)
MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index af88997..8205779 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -64,25 +64,23 @@ ELSE (WIN32)
ENDIF (WIN32)
-SET( GLUT_FOUND "NO" )
-IF(GLUT_INCLUDE_DIR)
- IF(GLUT_glut_LIBRARY)
- # Is -lXi and -lXmu required on all platforms that have it?
- # If not, we need some way to figure out what platform we are on.
- SET( GLUT_LIBRARIES
- ${GLUT_glut_LIBRARY}
- ${GLUT_Xmu_LIBRARY}
- ${GLUT_Xi_LIBRARY}
- ${GLUT_cocoa_LIBRARY}
- )
- SET( GLUT_FOUND "YES" )
-
- #The following deprecated settings are for backwards compatibility with CMake1.4
- SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
- SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
+
+IF (GLUT_FOUND)
+ # Is -lXi and -lXmu required on all platforms that have it?
+ # If not, we need some way to figure out what platform we are on.
+ SET( GLUT_LIBRARIES
+ ${GLUT_glut_LIBRARY}
+ ${GLUT_Xmu_LIBRARY}
+ ${GLUT_Xi_LIBRARY}
+ ${GLUT_cocoa_LIBRARY}
+ )
- ENDIF(GLUT_glut_LIBRARY)
-ENDIF(GLUT_INCLUDE_DIR)
+ #The following deprecated settings are for backwards compatibility with CMake1.4
+ SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
+ SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
+ENDIF(GLUT_FOUND)
MARK_AS_ADVANCED(
GLUT_INCLUDE_DIR
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index c44adb4..6dbc026 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -4,6 +4,7 @@
# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
# GETTEXT_FOUND: True if gettext has been found.
+# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
#
# Additionally it provides the following macros:
# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
@@ -42,11 +43,35 @@ FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
+IF(GETTEXT_MSGMERGE_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
+ OUTPUT_VARIABLE gettext_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]")
+ STRING(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}")
+ ENDIF()
+ UNSET(gettext_version)
+ENDIF(GETTEXT_MSGMERGE_EXECUTABLE)
+
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
+ REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
+ VERSION_VAR GETTEXT_VERSION_STRING)
INCLUDE(CMakeParseArguments)
+FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
+ SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
+ GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}")
+ IF(NOT currentCounter)
+ SET(currentCounter 1)
+ ENDIF()
+ SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
+ MATH(EXPR currentCounter "${currentCounter} + 1")
+ SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
+ENDFUNCTION()
+
MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
# make it a real variable, so we can modify it here
SET(_firstPoFile "${_firstPoFileArg}")
@@ -80,7 +105,15 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
ENDFOREACH (_currentPoFile )
- ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
+ IF(NOT TARGET translations)
+ ADD_CUSTOM_TARGET(translations)
+ ENDIF()
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
+
+ ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
+
+ ADD_DEPENDENCIES(translations ${uniqueTargetName})
ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
@@ -119,11 +152,20 @@ FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile)
LIST(APPEND _gmoFiles ${_gmoFile})
ENDFOREACH (_lang )
+ IF(NOT TARGET potfiles)
+ ADD_CUSTOM_TARGET(potfiles)
+ ENDIF()
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName)
+
IF(_parsedArguments_ALL)
- ADD_CUSTOM_TARGET(potfiles ALL DEPENDS ${_gmoFiles})
+ ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
ELSE(_parsedArguments_ALL)
- ADD_CUSTOM_TARGET(potfiles DEPENDS ${_gmoFiles})
+ ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles})
ENDIF(_parsedArguments_ALL)
+
+ ADD_DEPENDENCIES(potfiles ${uniqueTargetName})
+
ENDFUNCTION(GETTEXT_PROCESS_POT_FILE)
@@ -151,11 +193,21 @@ FUNCTION(GETTEXT_PROCESS_PO_FILES _lang)
LIST(APPEND _gmoFiles ${_gmoFile})
ENDFOREACH(_current_PO_FILE)
+
+ IF(NOT TARGET pofiles)
+ ADD_CUSTOM_TARGET(pofiles)
+ ENDIF()
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
+
IF(_parsedArguments_ALL)
- ADD_CUSTOM_TARGET(pofiles ALL DEPENDS ${_gmoFiles})
+ ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
ELSE(_parsedArguments_ALL)
- ADD_CUSTOM_TARGET(pofiles DEPENDS ${_gmoFiles})
+ ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles})
ENDIF(_parsedArguments_ALL)
+
+ ADD_DEPENDENCIES(pofiles ${uniqueTargetName})
+
ENDFUNCTION(GETTEXT_PROCESS_PO_FILES)
IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 503b640..f89d1af 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -1,6 +1,7 @@
# The module defines the following variables:
# GIT_EXECUTABLE - path to git command line client
# GIT_FOUND - true if the command line client was found
+# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
# Example usage:
# find_package(Git)
# if(GIT_FOUND)
@@ -9,6 +10,7 @@
#=============================================================================
# Copyright 2010 Kitware, Inc.
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -40,8 +42,21 @@ find_program(GIT_EXECUTABLE
)
mark_as_advanced(GIT_EXECUTABLE)
+if(GIT_EXECUTABLE)
+ execute_process(COMMAND ${GIT_EXECUTABLE} --version
+ OUTPUT_VARIABLE git_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (git_version MATCHES "^git version [0-9]")
+ string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
+ endif()
+ unset(git_version)
+endif(GIT_EXECUTABLE)
+
# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
+find_package_handle_standard_args(Git
+ REQUIRED_VARS GIT_EXECUTABLE
+ VERSION_VAR GIT_VERSION_STRING)
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index a437a1f..02f2964 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -35,9 +35,10 @@ IF (NOT WIN32)
# try using pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
# also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
- FIND_PACKAGE(PkgConfig)
- PKG_CHECK_MODULES(PC_GNUTLS gnutls)
+ FIND_PACKAGE(PkgConfig QUIET)
+ PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
+ SET(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION})
ENDIF (NOT WIN32)
FIND_PATH(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
@@ -57,7 +58,9 @@ MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
+ REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
+ VERSION_VAR GNUTLS_VERSION_STRING)
IF(GNUTLS_FOUND)
SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index 7c59f03..3e36e4b 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -4,6 +4,7 @@
#
# GNUPLOT_FOUND - system has Gnuplot
# GNUPLOT_EXECUTABLE - the Gnuplot executable
+# GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -29,13 +30,26 @@ FIND_PROGRAM(GNUPLOT_EXECUTABLE
${CYGWIN_INSTALL_PATH}/bin
)
+IF (GNUPLOT_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND "${GNUPLOT_EXECUTABLE}" --version
+ OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ STRING(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}")
+ STRING(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}")
+ UNSET(GNUPLOT_OUTPUT_VARIABLE)
+ENDIF()
+
# for compatibility
SET(GNUPLOT ${GNUPLOT_EXECUTABLE})
# handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot DEFAULT_MSG GNUPLOT_EXECUTABLE)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
+ REQUIRED_VARS GNUPLOT_EXECUTABLE
+ VERSION_VAR GNUPLOT_VERSION_STRING)
MARK_AS_ADVANCED( GNUPLOT_EXECUTABLE )
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 5e6fa20..52d575b 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -24,6 +24,8 @@
# ImageMagick_EXECUTABLE_DIR - Full path to executables directory.
# ImageMagick_<component>_FOUND - TRUE if <component> is found.
# ImageMagick_<component>_EXECUTABLE - Full path to <component> executable.
+# ImageMagick_VERSION_STRING - the version of ImageMagick found
+# (since CMake 2.8.8)
#
# There are also components for the following ImageMagick APIs:
#
@@ -53,6 +55,7 @@
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
# Copyright 2007-2008 Miguel A. Figueroa-Villanueva <miguelf at ieee dot org>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -134,7 +137,8 @@ FIND_PATH(ImageMagick_EXECUTABLE_DIR
# Find each component. Search for all tools in same dir
# <ImageMagick_EXECUTABLE_DIR>; otherwise they should be found
# independently and not in a cohesive module such as this one.
-SET(ImageMagick_FOUND TRUE)
+UNSET(ImageMagick_REQUIRED_VARS)
+UNSET(ImageMagick_DEFAULT_EXECUTABLES)
FOREACH(component ${ImageMagick_FIND_COMPONENTS}
# DEPRECATED: forced components for backward compatibility
convert mogrify import montage composite
@@ -143,37 +147,65 @@ FOREACH(component ${ImageMagick_FIND_COMPONENTS}
FIND_IMAGEMAGICK_API(Magick++ Magick++.h
Magick++ CORE_RL_Magick++_
)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
ELSEIF(component STREQUAL "MagickWand")
FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h
Wand MagickWand CORE_RL_wand_
)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
ELSEIF(component STREQUAL "MagickCore")
FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h
Magick MagickCore CORE_RL_magick_
)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
ELSE(component STREQUAL "Magick++")
IF(ImageMagick_EXECUTABLE_DIR)
FIND_IMAGEMAGICK_EXE(${component})
ENDIF(ImageMagick_EXECUTABLE_DIR)
+
+ IF(ImageMagick_FIND_COMPONENTS)
+ LIST(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested)
+ IF(is_requested GREATER -1)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE)
+ ENDIF(is_requested GREATER -1)
+ ELSEIF(ImageMagick_${component}_EXECUTABLE)
+ # if no components were requested explicitly put all (default) executables
+ # in the list
+ LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES "${ImageMagick_${component}_EXECUTABLE}")
+ ENDIF(ImageMagick_FIND_COMPONENTS)
ENDIF(component STREQUAL "Magick++")
-
- IF(NOT ImageMagick_${component}_FOUND)
- LIST(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested)
- IF(is_requested GREATER -1)
- SET(ImageMagick_FOUND FALSE)
- ENDIF(is_requested GREATER -1)
- ENDIF(NOT ImageMagick_${component}_FOUND)
ENDFOREACH(component)
+IF(NOT ImageMagick_FIND_COMPONENTS AND NOT ImageMagick_DEFAULT_EXECUTABLES)
+ # No components were requested, and none of the default components were
+ # found. Just insert mogrify into the list of the default components to
+ # find so FPHSA below has something to check
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_mogrify_EXECUTABLE)
+ELSEIF(ImageMagick_DEFAULT_EXECUTABLES)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ${ImageMagick_DEFAULT_EXECUTABLES})
+ENDIF()
+
SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS})
SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES})
+IF(ImageMagick_mogrify_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${ImageMagick_mogrify_EXECUTABLE} -version
+ OUTPUT_VARIABLE imagemagick_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(imagemagick_version MATCHES "^Version: ImageMagick [0-9]")
+ STRING(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}")
+ ENDIF()
+ UNSET(imagemagick_version)
+ENDIF(ImageMagick_mogrify_EXECUTABLE)
+
#---------------------------------------------------------------------
# Standard Package Output
#---------------------------------------------------------------------
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(
- ImageMagick DEFAULT_MSG ImageMagick_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick
+ REQUIRED_VARS ${ImageMagick_REQUIRED_VARS}
+ VERSION_VAR ImageMagick_VERSION_STRING
)
# Maintain consistency with all other variables.
SET(ImageMagick_FOUND ${IMAGEMAGICK_FOUND})
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index bae4c05..6dc7e4d 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -3,11 +3,13 @@
#
# JASPER_FOUND - system has Jasper
# JASPER_INCLUDE_DIR - the Jasper include directory
-# JASPER_LIBRARIES - The libraries needed to use Jasper
+# JASPER_LIBRARIES - the libraries needed to use Jasper
+# JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -19,19 +21,33 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-FIND_PACKAGE(JPEG)
-
FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h)
-FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper)
+IF (NOT JASPER_LIBRARIES)
+ FIND_PACKAGE(JPEG)
+
+ FIND_LIBRARY(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
+ FIND_LIBRARY(JASPER_LIBRARY_DEBUG NAMES jasperd)
+
+ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ SELECT_LIBRARY_CONFIGURATIONS(JASPER)
+ENDIF (NOT JASPER_LIBRARIES)
+
+IF (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
+ FILE(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
+
+ STRING(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
+ENDIF (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper DEFAULT_MSG JASPER_LIBRARY JASPER_INCLUDE_DIR JPEG_LIBRARIES)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
+ REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
+ VERSION_VAR JASPER_VERSION_STRING)
IF (JASPER_FOUND)
- SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
+ SET(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
ENDIF (JASPER_FOUND)
-MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARY)
+MARK_AS_ADVANCED(JASPER_INCLUDE_DIR)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 884266f..0ae98df 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -219,40 +219,69 @@ if (BLA_VENDOR STREQUAL "Generic" OR
endif ( NOT LAPACK_LIBRARIES )
endif ()
#intel lapack
- if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+ if (NOT WIN32)
+ set(LM "-lm")
+ endif ()
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
- if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_PACKAGE(Threads)
- else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
- find_package(Threads REQUIRED)
- endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
- if (BLA_F95)
- if(NOT LAPACK95_LIBRARIES)
- check_lapack_libraries(
- LAPACK95_LIBRARIES
- LAPACK
- cheev
- ""
- "mkl_lapack95"
- "${BLAS95_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT LAPACK95_LIBRARIES)
- else(BLA_F95)
- if(NOT LAPACK_LIBRARIES)
- check_lapack_libraries(
- LAPACK_LIBRARIES
- LAPACK
- cheev
- ""
- "mkl_lapack"
- "${BLAS_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT LAPACK_LIBRARIES)
- endif(BLA_F95)
+ else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_package(Threads REQUIRED)
+ endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ if (BLA_F95)
+ if(NOT LAPACK95_LIBRARIES)
+ # old
+ check_lapack_libraries(
+ LAPACK95_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "mkl_lapack95"
+ "${BLAS95_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif(NOT LAPACK95_LIBRARIES)
+ if(NOT LAPACK95_LIBRARIES)
+ # new >= 10.3
+ check_lapack_libraries(
+ LAPACK95_LIBRARIES
+ LAPACK
+ CHEEV
+ ""
+ "mkl_intel_lp64"
+ "${BLAS95_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif(NOT LAPACK95_LIBRARIES)
+ else(BLA_F95)
+ if(NOT LAPACK_LIBRARIES)
+ # old
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "mkl_lapack"
+ "${BLAS_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif(NOT LAPACK_LIBRARIES)
+ if(NOT LAPACK_LIBRARIES)
+ # new >= 10.3
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "mkl_gf_lp64"
+ "${BLAS_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif(NOT LAPACK_LIBRARIES)
+ endif(BLA_F95)
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
- endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
else(BLAS_FOUND)
message(STATUS "LAPACK requires BLAS")
endif(BLAS_FOUND)
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index cedcd24..be931c5 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -54,8 +54,9 @@ endif()
# itself includes this FindLibArchive when built with an older CMake that does
# not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.)
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
-find_package_handle_standard_args(LibArchive DEFAULT_MSG
- LibArchive_LIBRARY LibArchive_INCLUDE_DIR
+find_package_handle_standard_args(LibArchive
+ REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
+ VERSION_VAR LibArchive_VERSION
)
set(LibArchive_FOUND ${LIBARCHIVE_FOUND})
unset(LIBARCHIVE_FOUND)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 95ae180..48a5498 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -6,6 +6,7 @@
# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
+# LIBXML2_VERSION_STRING - the version of LibXml2 found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -23,8 +24,8 @@
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
-FIND_PACKAGE(PkgConfig)
-PKG_CHECK_MODULES(PC_LIBXML libxml-2.0 QUIET)
+FIND_PACKAGE(PkgConfig QUIET)
+PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
@@ -44,10 +45,22 @@ FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
# for backwards compat. with KDE 4.0.x:
SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
+IF(PC_LIBXML_VERSION)
+ SET(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION})
+ELSEIF(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
+ FILE(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str
+ REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"")
+
+ STRING(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ LIBXML2_VERSION_STRING "${libxml2_version_str}")
+ UNSET(libxml2_version_str)
+ENDIF()
+
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
+ REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
+ VERSION_VAR LIBXML2_VERSION_STRING)
MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
-
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index 1f49c3b..dd5aac4 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -5,6 +5,7 @@
# LIBXSLT_INCLUDE_DIR - the LibXslt include directory
# LIBXSLT_LIBRARIES - Link these to LibXslt
# LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt
+# LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8)
# Additionally, the following two variables are set (but not required for using xslt):
# LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library
# LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found
@@ -25,7 +26,7 @@
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
-FIND_PACKAGE(PkgConfig)
+FIND_PACKAGE(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_LIBXSLT QUIET libxslt)
SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER})
@@ -51,10 +52,21 @@ SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} )
FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc)
-# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
-# all listed variables are TRUE
+IF(PC_LIBXSLT_VERSION)
+ SET(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION})
+ELSEIF(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h")
+ FILE(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str
+ REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"")
+
+ STRING(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ LIBXSLT_VERSION_STRING "${libxslt_version_str}")
+ UNSET(libxslt_version_str)
+ENDIF()
+
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt
+ REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR
+ VERSION_VAR LIBXSLT_VERSION_STRING)
MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR
LIBXSLT_LIBRARIES
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index 123fd5d..b67dd4c 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -2,7 +2,8 @@
# This module defines
# LUA51_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
-# LUA_INCLUDE_DIR, where to find lua.h
+# LUA_INCLUDE_DIR, where to find lua.h
+# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
@@ -66,10 +67,19 @@ IF(LUA_LIBRARY)
ENDIF(UNIX AND NOT APPLE)
ENDIF(LUA_LIBRARY)
+IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
+ FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
+
+ STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
+ UNSET(lua_version_str)
+ENDIF()
+
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
+ VERSION_VAR LUA_VERSION_STRING)
MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 652803c..e1af15e 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -1,7 +1,7 @@
# - Finds OpenMP support
# This module can be used to detect OpenMP support in a compiler.
# If the compiler supports OpenMP, the flags required to compile with
-# openmp support are set.
+# openmp support are set.
#
# The following variables are set:
# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
@@ -13,6 +13,7 @@
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -24,31 +25,59 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CheckCSourceCompiles)
-include(CheckCXXSourceCompiles)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-
-set(OpenMP_C_FLAG_CANDIDATES
- #Gnu
- "-fopenmp"
- #Microsoft Visual Studio
- "/openmp"
- #Intel windows
- "-Qopenmp"
- #Intel
- "-openmp"
- #Empty, if compiler automatically accepts openmp
- " "
- #Sun
- "-xopenmp"
- #HP
- "+Oopenmp"
- #IBM XL C/c++
- "-qsmp"
- #Portland Group
- "-mp"
-)
-set(OpenMP_CXX_FLAG_CANDIDATES ${OpenMP_C_FLAG_CANDIDATES})
+get_property(_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+list(FIND _ENABLED_LANGUAGES "C" _HAVE_LANGUAGE_C)
+list(FIND _ENABLED_LANGUAGES "CXX" _HAVE_LANGUAGE_CXX)
+unset(_ENABLED_LANGUAGES)
+
+set(_OPENMP_REQUIRED_VARS)
+
+function(_OPENMP_FLAG_CANDIDATES LANG)
+ set(OpenMP_FLAG_CANDIDATES
+ #GNU
+ "-fopenmp"
+ #Microsoft Visual Studio
+ "/openmp"
+ #Intel windows
+ "-Qopenmp"
+ #PathScale, Intel
+ "-openmp"
+ #Empty, if compiler automatically accepts openmp
+ " "
+ #Sun
+ "-xopenmp"
+ #HP
+ "+Oopenmp"
+ #IBM XL C/c++
+ "-qsmp"
+ #Portland Group, MIPSpro
+ "-mp"
+ )
+
+ set(OMP_FLAG_GNU "-fopenmp")
+ set(OMP_FLAG_HP "+Oopenmp")
+ if(WIN32)
+ set(OMP_FLAG_Intel "-Qopenmp")
+ else()
+ set(OMP_FLAG_Intel "-openmp")
+ endif()
+ set(OMP_FLAG_MIPSpro "-mp")
+ set(OMP_FLAG_MSVC "/openmp")
+ set(OMP_FLAG_PathScale "-openmp")
+ set(OMP_FLAG_PGI "-mp")
+ set(OMP_FLAG_SunPro "-xopenmp")
+ set(OMP_FLAG_XL "-qsmp")
+
+ # Move the flag that matches the compiler to the head of the list,
+ # this is faster and doesn't clutter the output that much. If that
+ # flag doesn't work we will still try all.
+ if(OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})
+ list(REMOVE_ITEM OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ list(INSERT OpenMP_FLAG_CANDIDATES 0 "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ endif()
+
+ set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE)
+endfunction(_OPENMP_FLAG_CANDIDATES)
# sample openmp source code to test
set(OpenMP_C_TEST_SOURCE
@@ -62,53 +91,85 @@ int main() {
#endif
}
")
-# use the same source for CXX as C for now
-set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
-# if these are set then do not try to find them again,
-# by avoiding any try_compiles for the flags
-if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS)
- set(OpenMP_C_FLAG_CANDIDATES)
- set(OpenMP_CXX_FLAG_CANDIDATES)
-endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS)
# check c compiler
-foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${FLAG}")
- unset(OpenMP_FLAG_DETECTED CACHE)
- message(STATUS "Try OpenMP C flag = [${FLAG}]")
- check_c_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
- set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
- if(OpenMP_FLAG_DETECTED)
- set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
- break()
- endif(OpenMP_FLAG_DETECTED)
-endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
+if(NOT _HAVE_LANGUAGE_C EQUAL -1)
+ # if these are set then do not try to find them again,
+ # by avoiding any try_compiles for the flags
+ if(OpenMP_C_FLAGS)
+ unset(OpenMP_C_FLAG_CANDIDATES)
+ else()
+ _OPENMP_FLAG_CANDIDATES("C")
+ include(CheckCSourceCompiles)
+ endif()
+
+ foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
+ set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ unset(OpenMP_FLAG_DETECTED CACHE)
+ message(STATUS "Try OpenMP C flag = [${FLAG}]")
+ check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ if(OpenMP_FLAG_DETECTED)
+ set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
+ break()
+ endif(OpenMP_FLAG_DETECTED)
+ endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
+
+ set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
+ CACHE STRING "C compiler flags for OpenMP parallization")
+
+ list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS)
+ unset(OpenMP_C_FLAG_CANDIDATES)
+endif()
# check cxx compiler
-foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${FLAG}")
- unset(OpenMP_FLAG_DETECTED CACHE)
- message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
- check_cxx_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
- set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
- if(OpenMP_FLAG_DETECTED)
- set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}")
- break()
- endif(OpenMP_FLAG_DETECTED)
-endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
-
-set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
- CACHE STRING "C compiler flags for OpenMP parallization")
-
-set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
- CACHE STRING "C++ compiler flags for OpenMP parallization")
-# handle the standard arguments for find_package
-find_package_handle_standard_args(OpenMP DEFAULT_MSG
- OpenMP_C_FLAGS OpenMP_CXX_FLAGS )
-
-mark_as_advanced(
- OpenMP_C_FLAGS
- OpenMP_CXX_FLAGS
-)
+if(NOT _HAVE_LANGUAGE_CXX EQUAL -1)
+ # if these are set then do not try to find them again,
+ # by avoiding any try_compiles for the flags
+ if(OpenMP_CXX_FLAGS)
+ unset(OpenMP_CXX_FLAG_CANDIDATES)
+ else()
+ _OPENMP_FLAG_CANDIDATES("CXX")
+ include(CheckCXXSourceCompiles)
+
+ # use the same source for CXX as C for now
+ set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
+ endif()
+
+ foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
+ set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ unset(OpenMP_FLAG_DETECTED CACHE)
+ message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+ check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ if(OpenMP_FLAG_DETECTED)
+ set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}")
+ break()
+ endif(OpenMP_FLAG_DETECTED)
+ endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
+
+ set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
+ CACHE STRING "C++ compiler flags for OpenMP parallization")
+
+ list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS)
+ unset(OpenMP_CXX_FLAG_CANDIDATES)
+ unset(OpenMP_CXX_TEST_SOURCE)
+endif()
+
+unset(_HAVE_LANGUAGE_C)
+unset(_HAVE_LANGUAGE_CXX)
+
+if(_OPENMP_REQUIRED_VARS)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+ find_package_handle_standard_args(OpenMP
+ REQUIRED_VARS ${_OPENMP_REQUIRED_VARS})
+
+ mark_as_advanced(${_OPENMP_REQUIRED_VARS})
+
+ unset(_OPENMP_REQUIRED_VARS)
+else()
+ message(SEND_ERROR "FindOpenMP requires C or CXX language to be enabled")
+endif()
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index af799d6..d1fc2d2 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -7,7 +7,7 @@
# OPENSSL_FOUND - system has the OpenSSL library
# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
-# OPENSSL_VERSION - This is set to $major.$minor.$revision (eg. 0.9.8)
+# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -25,10 +25,8 @@
# License text for the above reference.)
if (UNIX)
- find_package(PkgConfig)
- if (PKG_CONFIG_FOUND)
- pkg_check_modules(_OPENSSL openssl)
- endif (PKG_CONFIG_FOUND)
+ find_package(PkgConfig QUIET)
+ pkg_check_modules(_OPENSSL QUIET openssl)
endif (UNIX)
# http://www.slproweb.com/products/Win32OpenSSL.html
@@ -215,17 +213,73 @@ ELSE(WIN32 AND NOT CYGWIN)
ENDIF(WIN32 AND NOT CYGWIN)
+function(from_hex HEX DEC)
+ string(TOUPPER "${HEX}" HEX)
+ set(_res 0)
+ string(LENGTH "${HEX}" _strlen)
+
+ while (_strlen GREATER 0)
+ math(EXPR _res "${_res} * 16")
+ string(SUBSTRING "${HEX}" 0 1 NIBBLE)
+ string(SUBSTRING "${HEX}" 1 -1 HEX)
+ if (NIBBLE STREQUAL "A")
+ math(EXPR _res "${_res} + 10")
+ elseif (NIBBLE STREQUAL "B")
+ math(EXPR _res "${_res} + 11")
+ elseif (NIBBLE STREQUAL "C")
+ math(EXPR _res "${_res} + 12")
+ elseif (NIBBLE STREQUAL "D")
+ math(EXPR _res "${_res} + 13")
+ elseif (NIBBLE STREQUAL "E")
+ math(EXPR _res "${_res} + 14")
+ elseif (NIBBLE STREQUAL "F")
+ math(EXPR _res "${_res} + 15")
+ else()
+ math(EXPR _res "${_res} + ${NIBBLE}")
+ endif()
+
+ string(LENGTH "${HEX}" _strlen)
+ endwhile()
+
+ set(${DEC} ${_res} PARENT_SCOPE)
+endfunction(from_hex)
+
if (OPENSSL_INCLUDE_DIR)
- file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*")
+ if (_OPENSSL_VERSION)
+ set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
+ elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
+ file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
+ REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
+
+ # The version number is encoded as 0xMNNFFPPS: major minor fix patch status
+ # The status gives if this is a developer or prerelease and is ignored here.
+ # Major, minor, and fix directly translate into the version numbers shown in
+ # the string. The patch field translates to the single character suffix that
+ # indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
+ # on.
- string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1" OPENSSL_VERSION_MAJOR "${openssl_version_str}")
- string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9]([0-9][0-9]).*$" "\\1" OPENSSL_VERSION_MINOR "${openssl_version_str}")
- string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" OPENSSL_VERSION_PATCH "${openssl_version_str}")
+ string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
+ "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
+ list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
+ list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
+ from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
+ list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
+ from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
+ list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
- string(REGEX REPLACE "^0" "" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}")
- string(REGEX REPLACE "^0" "" OPENSSL_VERSION_PATCH "${OPENSSL_VERSION_PATCH}")
+ if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
+ from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
+ # 96 is the ASCII code of 'a' minus 1
+ math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
+ unset(_tmp)
+ # Once anyone knows how OpenSSL would call the patch versions beyond 'z'
+ # this should be updated to handle that, too. This has not happened yet
+ # so it is simply ignored here for now.
+ string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
+ endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
- set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_PATCH}")
+ set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
+ endif (_OPENSSL_VERSION)
endif (OPENSSL_INCLUDE_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index f616973..a6c181c 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -7,6 +7,7 @@
# PNG_LIBRARIES, the libraries to link against to use PNG.
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
# PNG_FOUND, If false, do not try to use PNG.
+# PNG_VERSION_STRING - the version of the PNG library found (since CMake 2.8.8)
# Also defined, but not for general use are
# PNG_LIBRARY, where to find the PNG library.
# For backward compatiblity the variable PNG_INCLUDE_DIR is also set. It has the same value as PNG_INCLUDE_DIRS.
@@ -56,11 +57,19 @@ if(ZLIB_FOUND)
endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+ if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
+ file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"")
+
+ string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}")
+ unset(png_version_str)
+ endif (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
endif(ZLIB_FOUND)
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-find_package_handle_standard_args(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
+find_package_handle_standard_args(PNG
+ REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
+ VERSION_VAR PNG_VERSION_STRING)
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 1acb021..b503357 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -33,9 +33,9 @@
# messages include information about the required version and the version
# which has been actually found, both if the version is ok or not.
# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for
-# a find_package(... NO_MODULE) call, in this case all the information
-# provided by the config-mode of find_package() will be evaluated
-# automatically.
+# a find_package(... NO_MODULE) call. In this case VERSION_VAR will be set
+# to <NAME>_VERSION and the macro will automatically check whether the
+# Config module was found.
# Via FAIL_MESSAGE a custom failure message can be specified, if this is not
# used, the default message will be displayed.
#
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index db393e7..ae686df 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -1,8 +1,9 @@
# - Find perl
# this module looks for Perl
#
-# PERL_EXECUTABLE - the full path to perl
-# PERL_FOUND - If false, don't attempt to use perl.
+# PERL_EXECUTABLE - the full path to perl
+# PERL_FOUND - If false, don't attempt to use perl.
+# PERL_VERSION_STRING - version of perl found (since CMake 2.8.8)
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -39,12 +40,44 @@ FIND_PROGRAM(PERL_EXECUTABLE
PATHS ${PERL_POSSIBLE_BIN_PATHS}
)
+IF(PERL_EXECUTABLE)
+ ### PERL_VERSION
+ EXECUTE_PROCESS(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:version
+ OUTPUT_VARIABLE
+ PERL_VERSION_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_VERSION_RESULT_VARIABLE
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ IF(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'")
+ STRING(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ ELSE()
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -v
+ OUTPUT_VARIABLE PERL_VERSION_OUTPUT_VARIABLE
+ RESULT_VARIABLE PERL_VERSION_RESULT_VARIABLE
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ IF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]")
+ STRING(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ ELSEIF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +")
+ STRING(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ ENDIF()
+ ENDIF()
+ENDIF(PERL_EXECUTABLE)
+
# Deprecated settings for compatibility with CMake1.4
SET(PERL ${PERL_EXECUTABLE})
# handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl DEFAULT_MSG PERL_EXECUTABLE)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl
+ REQUIRED_VARS PERL_EXECUTABLE
+ VERSION_VAR PERL_VERSION_STRING)
MARK_AS_ADVANCED(PERL_EXECUTABLE)
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index eea55f1..b2ffd3c 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -55,19 +55,6 @@ if (PERL_EXECUTABLE)
string(REGEX REPLACE "prefix='([^']+)'.*" "\\1" PERL_PREFIX ${PERL_PREFIX_OUTPUT_VARIABLE})
endif (NOT PERL_PREFIX_RESULT_VARIABLE)
- ### PERL_VERSION
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:version
- OUTPUT_VARIABLE
- PERL_VERSION_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_VERSION_RESULT_VARIABLE
- )
- if (NOT PERL_VERSION_RESULT_VARIABLE)
- string(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION ${PERL_VERSION_OUTPUT_VARIABLE})
- endif (NOT PERL_VERSION_RESULT_VARIABLE)
-
### PERL_ARCHNAME
execute_process(
COMMAND
@@ -107,6 +94,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_SITESEARCH_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH)
endif (NOT PERL_SITESEARCH_RESULT_VARIABLE)
### PERL_SITELIB
@@ -120,6 +108,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_SITELIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB)
endif (NOT PERL_SITELIB_RESULT_VARIABLE)
### PERL_VENDORARCH
@@ -133,6 +122,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_VENDORARCH_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH)
endif (NOT PERL_VENDORARCH_RESULT_VARIABLE)
### PERL_VENDORLIB
@@ -146,6 +136,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_VENDORLIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB)
endif (NOT PERL_VENDORLIB_RESULT_VARIABLE)
macro(perl_adjust_darwin_lib_variable varname)
@@ -186,6 +177,7 @@ if (PERL_EXECUTABLE)
if (NOT PERL_ARCHLIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE})
perl_adjust_darwin_lib_variable( ARCHLIB )
+ file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB)
endif (NOT PERL_ARCHLIB_RESULT_VARIABLE)
### PERL_PRIVLIB
@@ -200,28 +192,10 @@ if (PERL_EXECUTABLE)
if (NOT PERL_PRIVLIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE})
perl_adjust_darwin_lib_variable( PRIVLIB )
+ file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB)
endif (NOT PERL_PRIVLIB_RESULT_VARIABLE)
-
- ### PERL_POSSIBLE_INCLUDE_PATHS
- set(PERL_POSSIBLE_INCLUDE_PATHS
- ${PERL_ARCHLIB}/CORE
- /usr/lib/perl5/${PERL_VERSION}/${PERL_ARCHNAME}/CORE
- /usr/lib/perl/${PERL_VERSION}/${PERL_ARCHNAME}/CORE
- /usr/lib/perl5/${PERL_VERSION}/CORE
- /usr/lib/perl/${PERL_VERSION}/CORE
- )
-
- ### PERL_POSSIBLE_LIB_PATHS
- set(PERL_POSSIBLE_LIB_PATHS
- ${PERL_ARCHLIB}/CORE
- /usr/lib/perl5/${PERL_VERSION}/${PERL_ARCHNAME}/CORE
- /usr/lib/perl/${PERL_VERSION}/${PERL_ARCHNAME}/CORE
- /usr/lib/perl5/${PERL_VERSION}/CORE
- /usr/lib/perl/${PERL_VERSION}/CORE
- )
-
- ### PERL_POSSIBLE_LIBRARY_NAME
+ ### PERL_POSSIBLE_LIBRARY_NAMES
execute_process(
COMMAND
${PERL_EXECUTABLE} -V:libperl
@@ -231,10 +205,9 @@ if (PERL_EXECUTABLE)
PERL_LIBRARY_RESULT_VARIABLE
)
if (NOT PERL_LIBRARY_RESULT_VARIABLE)
- foreach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS})
- string(REGEX REPLACE "libperl='([^']+)'" "\\1" PERL_LIBRARY_OUTPUT_VARIABLE ${PERL_LIBRARY_OUTPUT_VARIABLE})
- set(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${_perl_lib_path}/${PERL_LIBRARY_OUTPUT_VARIABLE}")
- endforeach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS})
+ string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE})
+ else (NOT PERL_LIBRARY_RESULT_VARIABLE)
+ set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl)
endif (NOT PERL_LIBRARY_RESULT_VARIABLE)
### PERL_INCLUDE_PATH
@@ -242,17 +215,23 @@ if (PERL_EXECUTABLE)
NAMES
perl.h
PATHS
- ${PERL_POSSIBLE_INCLUDE_PATHS}
+ ${PERL_ARCHLIB}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/CORE
)
-
+
### PERL_LIBRARY
find_library(PERL_LIBRARY
NAMES
- ${PERL_POSSIBLE_LIBRARY_NAME}
- perl${PERL_VERSION}
- perl
+ ${PERL_POSSIBLE_LIBRARY_NAMES}
PATHS
- ${PERL_POSSIBLE_LIB_PATHS}
+ ${PERL_ARCHLIB}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/CORE
)
endif (PERL_EXECUTABLE)
@@ -261,15 +240,16 @@ endif (PERL_EXECUTABLE)
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH
- VERSION_VAR PERL_VERSION)
+ VERSION_VAR PERL_VERSION_STRING)
# Introduced after CMake 2.6.4 to bring module into compliance
set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH})
set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH})
set(PERL_LIBRARIES ${PERL_LIBRARY})
+# For backward compatibility with CMake before 2.8.8
+set(PERL_VERSION ${PERL_VERSION_STRING})
mark_as_advanced(
PERL_INCLUDE_PATH
- PERL_EXECUTABLE
PERL_LIBRARY
)
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index c47f583..5d93ab1 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -13,14 +13,17 @@
# When the 'QUIET' argument is set, no status messages will be printed.
#
# It sets the following variables:
-# PKG_CONFIG_FOUND ... true if pkg-config works on the system
-# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
-# <PREFIX>_FOUND ... set to 1 if module(s) exist
+# PKG_CONFIG_FOUND ... true if pkg-config works on the system
+# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+# (since CMake 2.8.8)
+# PKG_CONFIG_FOUND ... if pkg-config executable was found
#
# For the following variables two sets of values exist; first one is the
# common one and has the given PREFIX. The second set contains flags
# which are given out when pkgconfig was called with the '--static'
# option.
+# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
@@ -85,15 +88,21 @@
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
-set(PKG_CONFIG_FOUND 0)
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
-if(PKG_CONFIG_EXECUTABLE)
- set(PKG_CONFIG_FOUND 1)
-endif(PKG_CONFIG_EXECUTABLE)
-
+if (PKG_CONFIG_EXECUTABLE)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif (PKG_CONFIG_EXECUTABLE)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(PkgConfig
+ REQUIRED_VARS PKG_CONFIG_EXECUTABLE
+ VERSION_VAR PKG_CONFIG_VERSION_STRING)
# Unsets the given variables
macro(_pkgconfig_unset var)
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 55f95c6..94e5676 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -1,20 +1,11 @@
# - Find the PostgreSQL installation.
-# Usage:
-# In your CMakeLists.txt file do something like this:
-# ...
-# # PostgreSQL
-# FIND_PACKAGE(PostgreSQL)
-# ...
-# if( PostgreSQL_FOUND )
-# include_directories(${PostgreSQL_INCLUDE_DIRS})
-# endif( PostgreSQL_FOUND )
-# ...
-# Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement.
-#
-#
# In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory
# will be C:\Program Files\PostgreSQL.
#
+# This module defines
+# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
+# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
+# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -150,11 +141,20 @@ find_library( PostgreSQL_LIBRARY
)
get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
+if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
+ file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ unset(pgsql_version_str)
+endif()
+
# Did we find anything?
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PostgreSQL DEFAULT_MSG
- PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR)
-
+find_package_handle_standard_args(PostgreSQL
+ REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
+ VERSION_VAR PostgreSQL_VERSION_STRING)
set( PostgreSQL_FOUND ${POSTGRESQL_FOUND})
# Now try to get the include and library path.
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 5344304..1e1e493 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -7,6 +7,9 @@
# (vsprojects/Debug & vsprojects/Release) will be searched
# for libraries and binaries.
#
+# PROTOBUF_IMPORT_DIRS - List of additional directories to be searched for
+# imported .proto files. (New in CMake 2.8.8)
+#
# Defines the following variables:
#
# PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files)
@@ -91,6 +94,16 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
endif()
+ if(DEFINED PROTOBUF_IMPORT_DIRS)
+ foreach(DIR ${PROTOBUF_IMPORT_DIRS})
+ get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ endif()
+
set(${SRCS})
set(${HDRS})
foreach(FIL ${ARGN})
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index a10ec23..5c1d56b 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -26,14 +26,51 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+unset(_Python_NAMES)
+
+set(_PYTHON1_VERSIONS 1.6 1.5)
+set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
+set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
+
+if(PythonInterp_FIND_VERSION)
+ if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+ string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
+ string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
+ list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
+ unset(_PYTHON_FIND_OTHER_VERSIONS)
+ if(NOT PythonInterp_FIND_VERSION_EXACT)
+ foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
+ list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
+ endif()
+ endforeach()
+ endif(NOT PythonInterp_FIND_VERSION_EXACT)
+ unset(_PYTHON_FIND_MAJ_MIN)
+ unset(_PYTHON_FIND_MAJ)
+ else(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+ list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
+ endif(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+else(PythonInterp_FIND_VERSION)
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
+endif(PythonInterp_FIND_VERSION)
+
+list(APPEND _Python_NAMES python)
+
# Search for the current active python version first
-find_program(PYTHON_EXECUTABLE NAMES python)
+find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
# Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front.
set(_Python_VERSIONS
${Python_ADDITIONAL_VERSIONS}
- 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
+ ${_PYTHON_FIND_OTHER_VERSIONS}
+ )
+
+unset(_PYTHON_FIND_OTHER_VERSIONS)
+unset(_PYTHON1_VERSIONS)
+unset(_PYTHON2_VERSIONS)
+unset(_PYTHON3_VERSIONS)
# Search for newest python version if python executable isn't found
if(NOT PYTHON_EXECUTABLE)
@@ -51,12 +88,29 @@ endif()
# determine python version string
if(PYTHON_EXECUTABLE)
- execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version ERROR_VARIABLE _VERSION OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE)
- string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}")
- string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
- string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
- string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
-endif()
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version
+ ERROR_VARIABLE _VERSION
+ RESULT_VARIABLE _PYTHON_VERSION_RESULT
+ OUTPUT_QUIET
+ ERROR_STRIP_TRAILING_WHITESPACE)
+ if(_PYTHON_VERSION_RESULT)
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" -V
+ ERROR_VARIABLE _VERSION
+ RESULT_VARIABLE _PYTHON_VERSION_RESULT
+ OUTPUT_QUIET
+ ERROR_STRIP_TRAILING_WHITESPACE)
+ endif(_PYTHON_VERSION_RESULT)
+ if(NOT _PYTHON_VERSION_RESULT AND _VERSION MATCHES "^Python [0-9]+\\.[0-9]+.*")
+ string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}")
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
+ if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
+ string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
+ endif()
+ endif()
+ unset(_PYTHON_VERSION_RESULT)
+ unset(_VERSION)
+endif(PYTHON_EXECUTABLE)
# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
# all listed variables are TRUE
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index bacbb07..86236cc 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -183,11 +183,14 @@ ENDIF(QT_UIC_EXECUTABLE)
IF (WIN32)
FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain
+ HINTS
+ $ENV{QTDIR}/lib
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+ PATHS
"$ENV{ProgramFiles}/qt/lib"
- $ENV{QTDIR}/lib "C:/Program Files/qt/lib"
+ "C:/Program Files/qt/lib"
DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise."
)
ENDIF (WIN32)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index c56827e..9b646b4 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -588,8 +588,9 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
SET(QT_QTCORE_FOUND 1)
ELSE()
- MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")
- MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly, or it wasn't found for cross compiling.")
+ MESSAGE(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" "
+ "but QtCore could not be found there. "
+ "Qt is NOT installed correctly for the target build environment.")
IF(Qt4_FIND_REQUIRED)
MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
ENDIF(Qt4_FIND_REQUIRED)
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 5d6c98a..5e973e4 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -61,49 +61,44 @@ FIND_PROGRAM(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES})
IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
- # query the ruby version
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MAJOR']"
- OUTPUT_VARIABLE RUBY_VERSION_MAJOR)
+ FUNCTION(_RUBY_CONFIG_VAR RBVAR OUTVAR)
+ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _RUBY_SUCCESS
+ OUTPUT_VARIABLE _RUBY_OUTPUT
+ ERROR_QUIET)
+ IF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT)
+ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _RUBY_SUCCESS
+ OUTPUT_VARIABLE _RUBY_OUTPUT
+ ERROR_QUIET)
+ ENDIF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT)
+ SET(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE)
+ ENDFUNCTION(_RUBY_CONFIG_VAR)
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MINOR']"
- OUTPUT_VARIABLE RUBY_VERSION_MINOR)
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['TEENY']"
- OUTPUT_VARIABLE RUBY_VERSION_PATCH)
+ # query the ruby version
+ _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR)
+ _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR)
+ _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH)
# query the different directories
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['archdir']"
- OUTPUT_VARIABLE RUBY_ARCH_DIR)
-
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['arch']"
- OUTPUT_VARIABLE RUBY_ARCH)
-
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubyhdrdir']"
- OUTPUT_VARIABLE RUBY_HDR_DIR)
-
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['libdir']"
- OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_DIR)
-
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubylibdir']"
- OUTPUT_VARIABLE RUBY_RUBY_LIB_DIR)
+ _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR)
+ _RUBY_CONFIG_VAR("arch" RUBY_ARCH)
+ _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR)
+ _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR)
+ _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR)
# site_ruby
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']"
- OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
-
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitelibdir']"
- OUTPUT_VARIABLE RUBY_SITELIB_DIR)
+ _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR)
+ _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR)
# vendor_ruby available ?
EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'"
OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET)
IF(RUBY_HAS_VENDOR_RUBY)
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']"
- OUTPUT_VARIABLE RUBY_VENDORLIB_DIR)
-
- EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']"
- OUTPUT_VARIABLE RUBY_VENDORARCH_DIR)
+ _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR)
+ _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR)
ENDIF(RUBY_HAS_VENDOR_RUBY)
# save the results in the cache so we don't have to run ruby the next time again
@@ -139,7 +134,7 @@ ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
# In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling)
# try to detect which version we found. This is not too good.
-IF(NOT RUBY_VERSION_MAJOR)
+IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
# by default assume 1.8.0
SET(RUBY_VERSION_MAJOR 1)
SET(RUBY_VERSION_MINOR 8)
@@ -149,13 +144,14 @@ IF(NOT RUBY_VERSION_MAJOR)
SET(RUBY_VERSION_MAJOR 1)
SET(RUBY_VERSION_MINOR 9)
ENDIF(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR)
-ENDIF(NOT RUBY_VERSION_MAJOR)
-
+ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
-SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
-SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}")
-SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}")
-SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}")
+IF(RUBY_VERSION_MAJOR)
+ SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
+ SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}")
+ SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}")
+ SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}")
+ENDIF(RUBY_VERSION_MAJOR)
FIND_PATH(RUBY_INCLUDE_DIR
NAMES ruby.h
@@ -167,7 +163,7 @@ FIND_PATH(RUBY_INCLUDE_DIR
SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} )
# if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir
-IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR)
+IF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
FIND_PATH(RUBY_CONFIG_INCLUDE_DIR
NAMES ruby/config.h config.h
HINTS
@@ -176,7 +172,7 @@ IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT
)
SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} )
-ENDIF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR)
+ENDIF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
# Determine the list of possible names for the ruby library
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index 0dc02f5..1c04726 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -81,7 +81,6 @@ FIND_PATH(SDL_INCLUDE_DIR SDL.h
/opt/csw # Blastwave
/opt
)
-#MESSAGE("SDL_INCLUDE_DIR is ${SDL_INCLUDE_DIR}")
# SDL-1.1 is the name used by FreeBSD ports...
# don't confuse it for the version number.
@@ -97,8 +96,6 @@ FIND_LIBRARY(SDL_LIBRARY_TEMP
/opt
)
-#MESSAGE("SDL_LIBRARY_TEMP is ${SDL_LIBRARY_TEMP}")
-
IF(NOT SDL_BUILDING_LIBRARY)
IF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
@@ -134,7 +131,6 @@ IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
-SET(SDL_FOUND "NO")
IF(SDL_LIBRARY_TEMP)
# For SDLmain
IF(NOT SDL_BUILDING_LIBRARY)
@@ -169,9 +165,9 @@ IF(SDL_LIBRARY_TEMP)
SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")
-
- SET(SDL_FOUND "YES")
ENDIF(SDL_LIBRARY_TEMP)
-#MESSAGE("SDL_LIBRARY is ${SDL_LIBRARY}")
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
+ REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR)
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
index 5a5f59b..9a130fa 100644
--- a/Modules/FindSDL_image.cmake
+++ b/Modules/FindSDL_image.cmake
@@ -68,8 +68,7 @@ FIND_LIBRARY(SDLIMAGE_LIBRARY
/opt
)
-SET(SDLIMAGE_FOUND "NO")
-IF(SDLIMAGE_LIBRARY AND SDLIMAGE_INCLUDE_DIR)
- SET(SDLIMAGE_FOUND "YES")
-ENDIF(SDLIMAGE_LIBRARY AND SDLIMAGE_INCLUDE_DIR)
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLIMAGE
+ REQUIRED_VARS SDLIMAGE_LIBRARY SDLIMAGE_INCLUDE_DIR)
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
index e2b2294..ce1ae9e 100644
--- a/Modules/FindSDL_mixer.cmake
+++ b/Modules/FindSDL_mixer.cmake
@@ -68,8 +68,7 @@ FIND_LIBRARY(SDLMIXER_LIBRARY
/opt
)
-SET(SDLMIXER_FOUND "NO")
-IF(SDLMIXER_LIBRARY AND SDLMIXER_INCLUDE_DIR)
- SET(SDLMIXER_FOUND "YES")
-ENDIF(SDLMIXER_LIBRARY AND SDLMIXER_INCLUDE_DIR)
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER
+ REQUIRED_VARS SDLMIXER_LIBRARY SDLMIXER_INCLUDE_DIR)
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
index 730b129..b5ada54 100644
--- a/Modules/FindSDL_net.cmake
+++ b/Modules/FindSDL_net.cmake
@@ -67,8 +67,7 @@ FIND_LIBRARY(SDLNET_LIBRARY
/opt
)
-SET(SDLNET_FOUND "NO")
-IF(SDLNET_LIBRARY AND SDLNET_INCLUDE_DIR)
- SET(SDLNET_FOUND "YES")
-ENDIF(SDLNET_LIBRARY AND SDLNET_INCLUDE_DIR)
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLNET
+ REQUIRED_VARS SDLNET_LIBRARY SDLNET_INCLUDE_DIR)
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index 959f3eb..8edf6ca 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -114,7 +114,6 @@ FIND_LIBRARY(SDL_SOUND_LIBRARY
/opt/lib
)
-SET(SDL_SOUND_FOUND "NO")
IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS
@@ -414,8 +413,9 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
ENDIF(NOT MY_RESULT)
SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries")
- SET(SDL_SOUND_FOUND "YES")
ENDIF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
- # MESSAGE("SDL_SOUND_LIBRARIES is ${SDL_SOUND_LIBRARIES}")
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_SOUND
+ REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
index b36ddd3..3d07ab7 100644
--- a/Modules/FindSDL_ttf.cmake
+++ b/Modules/FindSDL_ttf.cmake
@@ -68,8 +68,7 @@ FIND_LIBRARY(SDLTTF_LIBRARY
PATH_SUFFIXES lib64 lib
)
-SET(SDLTTF_FOUND "NO")
-IF(SDLTTF_LIBRARY AND SDLTTF_INCLUDE_DIR)
- SET(SDLTTF_FOUND "YES")
-ENDIF(SDLTTF_LIBRARY AND SDLTTF_INCLUDE_DIR)
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLTTF
+ REQUIRED_VARS SDLTTF_LIBRARY SDLTTF_INCLUDE_DIR)
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 13f32f8..f2c776f 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -48,10 +48,14 @@ INCLUDE(CMakeFindFrameworks)
INCLUDE(FindTclsh)
INCLUDE(FindWish)
-GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
-GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
-STRING(REGEX REPLACE
- "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+IF(TCLSH_VERSION_STRING)
+ SET(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
+ELSE(TCLSH_VERSION_STRING)
+ GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
+ GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
+ STRING(REGEX REPLACE
+ "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+ENDIF(TCLSH_VERSION_STRING)
GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index 714f65f..16f9e23 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -25,10 +25,21 @@ FIND_PATH(TIFF_INCLUDE_DIR tiff.h)
SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
+IF(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
+ FILE(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
+ REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
+
+ STRING(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*"
+ "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
+ UNSET(tiff_version_str)
+ENDIF()
+
# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF DEFAULT_MSG TIFF_LIBRARY TIFF_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
+ REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
+ VERSION_VAR TIFF_VERSION_STRING)
IF(TIFF_FOUND)
SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index 8fde59e..a45f285 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -82,9 +82,19 @@ FIND_PROGRAM(TCL_TCLSH
HINTS ${TCLTK_POSSIBLE_BIN_PATHS}
)
+IF(TCL_TCLSH)
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version"
+ COMMAND "${TCL_TCLSH}"
+ OUTPUT_VARIABLE TCLSH_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF(TCL_TCLSH)
+
# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh DEFAULT_MSG TCL_TCLSH)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
+ REQUIRED_VARS TCL_TCLSH
+ VERSION_VAR TCLSH_VERSION_STRING)
MARK_AS_ADVANCED(TCL_TCLSH)
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index a6c2df8..21614fb 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -23,6 +23,7 @@
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckLibraryExists)
+INCLUDE (CheckSymbolExists)
SET(Threads_FOUND FALSE)
# Do we have sproc?
@@ -44,33 +45,41 @@ ELSE()
#
SET(CMAKE_HAVE_THREADS_LIBRARY)
IF(NOT THREADS_HAVE_PTHREAD_ARG)
-
- # Do we have -lpthreads
- CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
- IF(CMAKE_HAVE_PTHREADS_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
+ # Check if pthread functions are in normal C library
+ CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE)
+ IF(CMAKE_HAVE_LIBC_CREATE)
+ SET(CMAKE_THREAD_LIBS_INIT "")
SET(CMAKE_HAVE_THREADS_LIBRARY 1)
SET(Threads_FOUND TRUE)
ENDIF()
- # Ok, how about -lpthread
- CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
- IF(CMAKE_HAVE_PTHREAD_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
- SET(Threads_FOUND TRUE)
- SET(CMAKE_HAVE_THREADS_LIBRARY 1)
- ENDIF()
+ IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
+ # Do we have -lpthreads
+ CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
+ IF(CMAKE_HAVE_PTHREADS_CREATE)
+ SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
+ SET(CMAKE_HAVE_THREADS_LIBRARY 1)
+ SET(Threads_FOUND TRUE)
+ ENDIF()
- IF(CMAKE_SYSTEM MATCHES "SunOS.*")
- # On sun also check for -lthread
- CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
- IF(CMAKE_HAVE_THR_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "-lthread")
+ # Ok, how about -lpthread
+ CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
+ IF(CMAKE_HAVE_PTHREAD_CREATE)
+ SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
SET(CMAKE_HAVE_THREADS_LIBRARY 1)
SET(Threads_FOUND TRUE)
ENDIF()
- ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
+ IF(CMAKE_SYSTEM MATCHES "SunOS.*")
+ # On sun also check for -lthread
+ CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
+ IF(CMAKE_HAVE_THR_CREATE)
+ SET(CMAKE_THREAD_LIBS_INIT "-lthread")
+ SET(CMAKE_HAVE_THREADS_LIBRARY 1)
+ SET(Threads_FOUND TRUE)
+ ENDIF()
+ ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
+ ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
@@ -111,7 +120,7 @@ ELSE()
ENDIF(CMAKE_HAVE_PTHREAD_H)
ENDIF()
-IF(CMAKE_THREAD_LIBS_INIT)
+IF(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ENDIF()
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 04646c0..76fb3c9 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -20,7 +20,7 @@
# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND
-# X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND
+# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND
# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND
@@ -29,6 +29,7 @@
# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND
# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND
+# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND
# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND
# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND
# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND
@@ -103,6 +104,7 @@ IF (UNIX)
FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH})
@@ -134,6 +136,7 @@ IF (UNIX)
FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
@@ -143,6 +146,7 @@ IF (UNIX)
FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
SET(X11_LIBRARY_DIR "")
IF(X11_X11_LIB)
@@ -267,10 +271,10 @@ IF (UNIX)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH})
ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
- IF (X11_xf86vmode_INCLUDE_PATH)
+ IF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB)
SET(X11_xf86vmode_FOUND TRUE)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH})
- ENDIF (X11_xf86vmode_INCLUDE_PATH)
+ ENDIF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB)
IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
SET(X11_Xcursor_FOUND TRUE)
@@ -297,6 +301,11 @@ IF (UNIX)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} )
ENDIF (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH)
+ IF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB)
+ SET(X11_Xmu_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH})
+ ENDIF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB)
+
IF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
SET(X11_Xinput_FOUND TRUE)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH})
@@ -435,6 +444,7 @@ IF (UNIX)
X11_XRes_INCLUDE_PATH
X11_Xxf86misc_LIB
X11_xf86misc_INCLUDE_PATH
+ X11_Xxf86vm_LIB
X11_xf86vmode_INCLUDE_PATH
X11_Xi_LIB
X11_Xi_INCLUDE_PATH
@@ -456,6 +466,8 @@ IF (UNIX)
X11_Xkblib_INCLUDE_PATH
X11_Xkbfile_INCLUDE_PATH
X11_Xkbfile_LIB
+ X11_Xmu_INCLUDE_PATH
+ X11_Xmu_LIB
X11_Xscreensaver_INCLUDE_PATH
X11_Xscreensaver_LIB
X11_Xpm_INCLUDE_PATH
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
new file mode 100644
index 0000000..f89e25f
--- /dev/null
+++ b/Modules/FindosgPresentation.cmake
@@ -0,0 +1,52 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgPresentation
+# This module defines
+#
+# OSGPRESENTATION_FOUND - Was osgPresentation found?
+# OSGPRESENTATION_INCLUDE_DIR - Where to find the headers
+# OSGPRESENTATION_LIBRARIES - The libraries to link for osgPresentation (use this)
+#
+# OSGPRESENTATION_LIBRARY - The osgPresentation library
+# OSGPRESENTATION_LIBRARY_DEBUG - The osgPresentation debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+# Modified to work with osgPresentation by Robert Osfield, January 2012.
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgPresentation/SlideEventHandler>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGPRESENTATION osgPresentation/SlideEventHandler)
+OSG_FIND_LIBRARY(OSGPRESENTATION osgPresentation)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgPresentation DEFAULT_MSG
+ OSGPRESENTATION_LIBRARY OSGPRESENTATION_INCLUDE_DIR)
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
new file mode 100644
index 0000000..ddc9128
--- /dev/null
+++ b/Modules/FindosgQt.cmake
@@ -0,0 +1,52 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgQt
+# This module defines
+#
+# OSGQT_FOUND - Was osgQt found?
+# OSGQT_INCLUDE_DIR - Where to find the headers
+# OSGQT_LIBRARIES - The libraries to link for osgQt (use this)
+#
+# OSGQT_LIBRARY - The osgQt library
+# OSGQT_LIBRARY_DEBUG - The osgQt debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+# Modified to work with osgQt by Robert Osfield, January 2012.
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgQt/GraphicsWindowQt>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGQT osgQt/GraphicsWindowQt)
+OSG_FIND_LIBRARY(OSGQT osgQt)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgQt DEFAULT_MSG
+ OSGQT_LIBRARY OSGQT_INCLUDE_DIR)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 781b6e7..f3f61f6 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -173,7 +173,7 @@ macro(_test_compiler_hidden_visibility)
_gcc_version "${_gcc_version_info}")
endif()
- if(${_gcc_version} VERSION_LESS "4.2")
+ if("${_gcc_version}" VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
message(WARNING "GCC version older than 4.2")
endif()
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 2efa079..8761f40 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -304,6 +304,26 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
endif(NOT resolved)
if(NOT resolved)
+ if(item MATCHES "@rpath")
+ #
+ # @rpath references are relative to the paths built into the binaries with -rpath
+ # We handle this case like we do for other Unixes
+ #
+ string(REPLACE "@rpath/" "" norpath_item "${item}")
+
+ set(ri "ri-NOTFOUND")
+ find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+ if(ri)
+ #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ set(ri "ri-NOTFOUND")
+ endif(ri)
+
+ endif(item MATCHES "@rpath")
+ endif(NOT resolved)
+
+ if(NOT resolved)
set(ri "ri-NOTFOUND")
find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
@@ -461,6 +481,15 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
get_filename_component(path "${lower}" PATH)
if("${original_path}" STREQUAL "${path}")
set(is_local 1)
+ else()
+ string(LENGTH "${original_path}/" original_length)
+ string(LENGTH "${lower}" path_length)
+ if(${path_length} GREATER ${original_length})
+ string(SUBSTRING "${lower}" 0 ${original_length} path)
+ if("${original_path}/" STREQUAL "${path}")
+ set(is_embedded 1)
+ endif()
+ endif()
endif()
endif()
endif()
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
index 6259a5b..819cc5c 100644
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -922,12 +922,12 @@ Function .onInit
Pop $0
UserInfo::GetAccountType
Pop $1
- StrCmp $1 "Admin" 0 +3
+ StrCmp $1 "Admin" 0 +4
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Admin group'
StrCpy $SV_ALLUSERS "AllUsers"
Goto done
- StrCmp $1 "Power" 0 +3
+ StrCmp $1 "Power" 0 +4
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Power Users group'
StrCpy $SV_ALLUSERS "AllUsers"
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 4da1a3f..f327125 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -393,7 +393,13 @@ MACRO(QT4_CREATE_TRANSLATION _qm_files)
FOREACH(_pro_src ${_my_sources})
SET(_pro_srcs "${_pro_srcs} \"${_pro_src}\"")
ENDFOREACH(_pro_src ${_my_sources})
- FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}")
+ SET(_pro_includes)
+ GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
+ FOREACH(_pro_include ${_inc_DIRS})
+ GET_FILENAME_COMPONENT(_abs_include "${_pro_include}" ABSOLUTE)
+ SET(_pro_includes "${_pro_includes} \"${_abs_include}\"")
+ ENDFOREACH(_pro_include ${CMAKE_CXX_INCLUDE_PATH})
+ FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH = ${_pro_includes}\n")
ENDIF(_my_sources)
ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file}
COMMAND ${QT_LUPDATE_EXECUTABLE}
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index 51b4dda..2e8ade0 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -15,7 +15,6 @@
# basename_LIBRARY and basename_LIBRARIES will take only the release values.
#=============================================================================
-# Copyright 2009 Kitware, Inc.
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
# Copyright 2005-2009 Kitware, Inc.
#
@@ -49,7 +48,8 @@ macro( select_library_configurations basename )
# if only the debug version was found, set the release value to be the
# debug value.
_set_library_name( ${basename} DEBUG RELEASE )
- if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
+ if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
+ NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE)
# if the generator supports configuration types or CMAKE_BUILD_TYPE
# is set, then set optimized and debug options.
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
@@ -65,7 +65,7 @@ macro( select_library_configurations basename )
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
- endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
+ endif()
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
"The ${basename} library" )
@@ -79,4 +79,3 @@ macro( select_library_configurations basename )
${basename}_LIBRARY_DEBUG
)
endmacro( select_library_configurations )
-
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index b78278c..84d0afd 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -25,6 +25,15 @@
# set(CMAKE_JAVA_TARGET_OUTPUT_NAME shibboleet.jar)
# add_jar(foobar foobar.java)
#
+# To use a different output directory than CMAKE_CURRENT_BINARY_DIR
+# you can set it with:
+#
+# set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
+#
+# To define an entry point in your jar you can set it with:
+#
+# set(CMAKE_JAVA_JAR_ENTRY_POINT com/examples/MyProject/Main)
+#
# To add a VERSION to the target output name you can set it using
# CMAKE_JAVA_TARGET_VERSION. This will create a jar file with the name
# shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
@@ -112,7 +121,7 @@
# [VERSION TRUE|FALSE]
# )
#
-# Create jave documentation based on files or packages. For more
+# Create java documentation based on files or packages. For more
# details please read the javadoc manpage.
#
# There are two main signatures for create_javadoc. The first
@@ -198,10 +207,19 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
function(add_jar _TARGET_NAME)
set(_JAVA_SOURCE_FILES ${ARGN})
+ if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+ set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ endif(NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+
+ if (CMAKE_JAVA_JAR_ENTRY_POINT)
+ set(_ENTRY_POINT_OPTION e)
+ set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT})
+ endif (CMAKE_JAVA_JAR_ENTRY_POINT)
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else (LIBRARY_OUTPUT_PATH)
- set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
+ set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR})
endif (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_INCLUDE_PATH
@@ -221,7 +239,7 @@ function(add_jar _TARGET_NAME)
set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach(JAVA_INCLUDE_DIR)
- set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
+ set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
if (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION)
@@ -246,7 +264,7 @@ function(add_jar _TARGET_NAME)
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
- file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL})
+ file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
@@ -312,20 +330,22 @@ function(add_jar _TARGET_NAME)
endif (_JAVA_COMPILE_FILES)
# create the jar file
+ set(_JAVA_JAR_OUTPUT_PATH
+ ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
if (CMAKE_JNI_TARGET)
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
- -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
-D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
-P ${_JAVA_SYMLINK_SCRIPT}
COMMAND ${CMAKE_COMMAND}
- -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}
- -D_JAVA_TARGET_OUTPUT_NAME=${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
+ -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH}
-D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
-P ${_JAVA_SYMLINK_SCRIPT}
DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
@@ -334,12 +354,12 @@ function(add_jar _TARGET_NAME)
)
else ()
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
- -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
-D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
-P ${_JAVA_SYMLINK_SCRIPT}
@@ -350,14 +370,14 @@ function(add_jar _TARGET_NAME)
endif (CMAKE_JNI_TARGET)
# Add the target and make sure we have the latest resource files.
- add_custom_target(${_TARGET_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
+ add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH})
set_property(
TARGET
${_TARGET_NAME}
PROPERTY
INSTALL_FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ ${_JAVA_JAR_OUTPUT_PATH}
)
if (_JAVA_TARGET_OUTPUT_LINK)
@@ -366,8 +386,8 @@ function(add_jar _TARGET_NAME)
${_TARGET_NAME}
PROPERTY
INSTALL_FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
- ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
+ ${_JAVA_JAR_OUTPUT_PATH}
+ ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
)
if (CMAKE_JNI_TARGET)
@@ -376,7 +396,7 @@ function(add_jar _TARGET_NAME)
${_TARGET_NAME}
PROPERTY
JNI_SYMLINK
- ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
+ ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
)
endif (CMAKE_JNI_TARGET)
endif (_JAVA_TARGET_OUTPUT_LINK)
@@ -386,7 +406,7 @@ function(add_jar _TARGET_NAME)
${_TARGET_NAME}
PROPERTY
JAR_FILE
- ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
+ ${_JAVA_JAR_OUTPUT_PATH}
)
set_property(
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index b5115b7..0c420b9 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -449,6 +449,8 @@ SET(CPACK_SRCS
CPack/cmCPackTarBZip2Generator.cxx
CPack/cmCPackTarCompressGenerator.cxx
CPack/cmCPackZIPGenerator.cxx
+ CPack/cmCPackDocumentVariables.cxx
+ CPack/cmCPackDocumentMacros.cxx
)
IF(CYGWIN)
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 0ce5b01..0ff9050 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -57,13 +57,20 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive,
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
// Change to local toplevel
cmSystemTools::ChangeDirectory(localToplevel.c_str());
+ std::string filePrefix;
+ if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY"))
+ {
+ filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ filePrefix += "/";
+ }
std::vector<std::string>::const_iterator fileIt;
for (fileIt = component->Files.begin(); fileIt != component->Files.end();
++fileIt )
{
+ std::string rp = filePrefix + *fileIt;
cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: "
- << (*fileIt) << std::endl);
- archive.Add(*fileIt);
+ << rp << std::endl);
+ archive.Add(rp);
if (!archive)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx
new file mode 100644
index 0000000..ddc75a4
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentMacros.cxx
@@ -0,0 +1,16 @@
+#include "cmCPackDocumentMacros.h"
+
+void cmCPackDocumentMacros::GetMacrosDocumentation(
+ std::vector<cmDocumentationEntry>& )
+{
+ // Commented-out example of use
+ //
+ // cmDocumentationEntry e("cpack_<macro>",
+ // "Brief Description"
+ // "which may be on several lines.",
+ // "Long description in pre-formatted format"
+ // " blah\n"
+ // " blah\n"
+ //);
+ //v.push_back(e);
+}
diff --git a/Source/CPack/cmCPackDocumentMacros.h b/Source/CPack/cmCPackDocumentMacros.h
new file mode 100644
index 0000000..544f74f
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentMacros.h
@@ -0,0 +1,21 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCPackDocumentMacros_h
+#define cmCPackDocumentMacros_h
+#include "cmStandardIncludes.h"
+class cmCPackDocumentMacros
+{
+public:
+ static void GetMacrosDocumentation(std::vector<cmDocumentationEntry>& v);
+};
+
+#endif
diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx
new file mode 100644
index 0000000..68cde78
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentVariables.cxx
@@ -0,0 +1,32 @@
+#include "cmCPackDocumentVariables.h"
+#include "cmake.h"
+
+void cmCPackDocumentVariables::DefineVariables(cmake* cm)
+{
+ // Subsection: variables defined/used by cpack,
+ // which are common to all CPack generators
+
+ cm->DefineProperty
+ ("CPACK_PACKAGING_INSTALL_PREFIX", cmProperty::VARIABLE,
+ "The prefix used in the built package.",
+ "Each CPack generator has a default value (like /usr)."
+ " This default value may"
+ " be overwritten from the CMakeLists.txt or the cpack command line"
+ " by setting an alternative value.\n"
+ "e.g. "
+ " set(CPACK_PACKAGING_INSTALL_PREFIX \"/opt\")\n"
+ "This is not the same purpose as CMAKE_INSTALL_PREFIX which"
+ " is used when installing from the build tree without building"
+ " a package."
+ "", false,
+ "Variables common to all CPack generators");
+
+ // Subsection: variables defined/used by cpack,
+ // which are specific to one CPack generator
+// cm->DefineProperty
+// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE,
+// "RPM specific package name.",
+// "If not specified, defaults to CPACK_PACKAGE_NAME."
+// "", false,
+// "Variables specific to a CPack generator");
+}
diff --git a/Source/CPack/cmCPackDocumentVariables.h b/Source/CPack/cmCPackDocumentVariables.h
new file mode 100644
index 0000000..e7971be
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentVariables.h
@@ -0,0 +1,21 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCPackDocumentVariables_h
+#define cmCPackDocumentVariables_h
+class cmake;
+class cmCPackDocumentVariables
+{
+public:
+ static void DefineVariables(cmake* cm);
+};
+
+#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 083279f..f7d8a4d 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -691,6 +691,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// one install directory for each component.
tempInstallDirectory +=
GetComponentInstallDirNameSuffix(installComponent);
+ if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY"))
+ {
+ tempInstallDirectory += "/";
+ tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ }
}
if (!setDestDir)
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 2b94067..0787ef9 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -344,9 +344,9 @@ int cmCPackNSISGenerator::InitializeInternal()
if ( cmSystemTools::IsOn(this->GetOption(
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) )
{
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. "
- "This option will be ignored."
+ cmCPackLogger(cmCPackLog::LOG_WARNING,
+ "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
+ "This option will be reset to 0 (for this generator only)."
<< std::endl);
this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0);
}
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 163f744..6f5055c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -14,6 +14,8 @@
// Need these for documentation support.
#include "cmake.h"
#include "cmDocumentation.h"
+#include "cmCPackDocumentVariables.h"
+#include "cmCPackDocumentMacros.h"
#include "cmCPackGeneratorFactory.h"
#include "cmCPackGenerator.h"
#include "cmake.h"
@@ -24,6 +26,7 @@
#include "cmCPackLog.h"
#include <cmsys/CommandLineArguments.hxx>
+#include <cmsys/SystemTools.hxx>
#include <memory> // auto_ptr
//----------------------------------------------------------------------------
@@ -90,6 +93,40 @@ static const char * cmDocumentationOptions[][3] =
"If vendor is not specified on cpack command line "
"(or inside CMakeLists.txt) then"
"CPack.cmake defines it with a default value"},
+ {"--help-command cmd [file]", "Print help for a single command and exit.",
+ "Full documentation specific to the given command is displayed. "
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-command-list [file]", "List available commands and exit.",
+ "The list contains all commands for which help may be obtained by using "
+ "the --help-command argument followed by a command name. "
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-commands [file]", "Print help for all commands and exit.",
+ "Full documentation specific for all current command is displayed."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-variable var [file]",
+ "Print help for a single variable and exit.",
+ "Full documentation specific to the given variable is displayed."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-variable-list [file]", "List documented variables and exit.",
+ "The list contains all variables for which help may be obtained by using "
+ "the --help-variable argument followed by a variable name. If a file is "
+ "specified, the help is written into it."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-variables [file]", "Print help for all variables and exit.",
+ "Full documentation for all variables is displayed."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
{0,0,0}
};
@@ -137,12 +174,15 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
+
//----------------------------------------------------------------------------
// this is CPack.
int main (int argc, char *argv[])
{
cmSystemTools::FindExecutableDirectory(argv[0]);
cmCPackLog log;
+ int nocwd = 0;
+
log.SetErrorPrefix("CPack Error: ");
log.SetWarningPrefix("CPack Warning: ");
log.SetOutputPrefix("CPack: ");
@@ -154,6 +194,7 @@ int main (int argc, char *argv[])
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Current working directory cannot be established." << std::endl);
+ nocwd = 1;
}
std::string generator;
@@ -179,7 +220,6 @@ int main (int argc, char *argv[])
cpackConfigFile = "";
- cmDocumentation doc;
cmsys::CommandLineArguments arg;
arg.Initialize(argc, argv);
typedef cmsys::CommandLineArguments argT;
@@ -252,17 +292,25 @@ int main (int argc, char *argv[])
generators.SetLogger(&log);
cmCPackGenerator* cpackGenerator = 0;
- if ( !helpFull.empty() || !helpMAN.empty() ||
- !helpHTML.empty() || helpVersion )
+ cmDocumentation doc;
+ doc.addCPackStandardDocSections();
+ /* Were we invoked to display doc or to do some work ? */
+ if(doc.CheckOptions(argc, argv,"-G") || nocwd)
{
- help = true;
+ help = true;
}
+ else
+ {
+ help = false;
+ }
+
+ // This part is used for cpack documentation lookup as well.
+ cminst.AddCMakePaths();
if ( parsed && !help )
{
// find out which system cpack is running on, so it can setup the search
// paths, so FIND_XXX() commands can be used in scripts
- cminst.AddCMakePaths();
std::string systemFile =
globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
if (!globalMF->ReadListFile(0, systemFile.c_str()))
@@ -465,14 +513,48 @@ int main (int argc, char *argv[])
*/
if ( help )
{
- doc.CheckOptions(argc, argv);
// Construct and print requested documentation.
+
doc.SetName("cpack");
doc.SetSection("Name",cmDocumentationName);
doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription);
doc.PrependSection("Options",cmDocumentationOptions);
+ // statically (in C++ code) defined variables
+ cmCPackDocumentVariables::DefineVariables(&cminst);
+
+ std::vector<cmDocumentationEntry> commands;
+
+ std::string docedFile;
+ std::string docPath;
+ cmDocumentation::documentedModulesList_t docedModList;
+
+ docedFile = globalMF->GetModulesFile("CPack.cmake");
+ if (docedFile.length()!=0)
+ {
+ docPath = cmSystemTools::GetFilenamePath(docedFile.c_str());
+ doc.getDocumentedModulesListInDir(docPath,"CPack*.cmake",docedModList);
+ }
+
+ // parse the files for documentation.
+ cmDocumentation::documentedModulesList_t::iterator docedIt;
+ for (docedIt = docedModList.begin();
+ docedIt!= docedModList.end(); ++docedIt)
+ {
+ doc.GetStructuredDocFromFile(
+ (docedIt->first).c_str(),
+ commands,&cminst);
+ }
+
+ std::map<std::string,cmDocumentationSection *> propDocs;
+ cminst.GetPropertiesDocumentation(propDocs);
+ doc.SetSections(propDocs);
+ cminst.GetCommandDocumentation(commands,true,false);
+ // statically (in C++ code) defined macros/commands
+ cmCPackDocumentMacros::GetMacrosDocumentation(commands);
+ doc.SetSection("Commands",commands);
+
std::vector<cmDocumentationEntry> v;
cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt;
for( generatorIt = generators.GetGeneratorsList().begin();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 0b1c9fe..309abb1 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -555,7 +555,7 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumFile << "\t<File Name=\"" << cmXMLSafe(fileName)
<< "\" FullPath=\"" << cmXMLSafe(
this->CTest->GetShortPathToFile(fullFileName.c_str()))
- << "\" Covered=\"" << (tested > 0 ? "true":"false") << "\">\n"
+ << "\" Covered=\"" << (tested+untested > 0 ? "true":"false") << "\">\n"
<< "\t\t<LOCTested>" << tested << "</LOCTested>\n"
<< "\t\t<LOCUnTested>" << untested << "</LOCUnTested>\n"
<< "\t\t<PercentCoverage>";
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index b1a72af..623d7d3 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -102,6 +102,7 @@ int main(int argc, char** argv)
{
cmSystemTools::FindExecutableDirectory(argv[0]);
cmDocumentation doc;
+ doc.addCMakeStandardDocSections();
if(doc.CheckOptions(argc, argv))
{
cmake hcm;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 6c7627f..4fee0bb 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -409,12 +409,11 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
char thirdLine[512]="";
if (process)
{
- sprintf(firstLine,
- " ");
- sprintf(secondLine,
- " ");
- sprintf(thirdLine,
- " ");
+ const char* clearLine =
+ " ";
+ strcpy(firstLine, clearLine);
+ strcpy(secondLine, clearLine);
+ strcpy(thirdLine, clearLine);
}
else
{
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 4785188..056e48e 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -10,11 +10,11 @@
# See the License for more information.
#=============================================================================
PROJECT(QtDialog)
-SET(QT_MIN_VERSION "4.3.0")
+SET(QT_MIN_VERSION "4.4.0")
FIND_PACKAGE(Qt4 REQUIRED)
IF(NOT QT4_FOUND)
- MESSAGE(SEND_ERROR "Failed to find Qt 4.3 or greater.")
+ MESSAGE(SEND_ERROR "Failed to find Qt 4.4 or greater.")
ELSE(NOT QT4_FOUND)
INCLUDE(${QT_USE_FILE})
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 7ba7f51..b4f3d72 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -64,6 +64,7 @@ int main(int argc, char** argv)
// check docs first so that X is not need to get docs
// do docs, if args were given
cmDocumentation doc;
+ doc.addCMakeStandardDocSections();
if(argc >1 && doc.CheckOptions(argc, argv))
{
// Construct and print requested documentation.
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 338eaff..45b4cd3 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -554,8 +554,7 @@ void CMakeSetupDialog::doHelp()
void CMakeSetupDialog::doInterrupt()
{
this->enterState(Interrupting);
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "interrupt", Qt::QueuedConnection);
+ this->CMakeThread->cmakeInstance()->interrupt();
}
void CMakeSetupDialog::doSourceBrowse()
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index a40a175..73050f3 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -63,6 +63,8 @@ QCMake::QCMake(QObject* p)
#endif
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
+ cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this);
+
std::vector<std::string> generators;
this->CMakeInstance->GetRegisteredGenerators(generators);
std::vector<std::string>::iterator iter;
@@ -170,6 +172,7 @@ void QCMake::configure()
this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode);
this->CMakeInstance->PreLoadCMakeFiles();
+ InterruptFlag = 0;
cmSystemTools::ResetErrorOccuredFlag();
int err = this->CMakeInstance->Configure();
@@ -188,7 +191,9 @@ void QCMake::generate()
UINT lastErrorMode = SetErrorMode(0);
#endif
+ InterruptFlag = 0;
cmSystemTools::ResetErrorOccuredFlag();
+
int err = this->CMakeInstance->Generate();
#ifdef Q_OS_WIN
@@ -337,7 +342,13 @@ QCMakePropertyList QCMake::properties() const
void QCMake::interrupt()
{
- cmSystemTools::SetFatalErrorOccured();
+ this->InterruptFlag.ref();
+}
+
+bool QCMake::interruptCallback(void* cd)
+{
+ QCMake* self = reinterpret_cast<QCMake*>(cd);
+ return self->InterruptFlag;
}
void QCMake::progressCallback(const char* msg, float percent, void* cd)
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 0d10823..0d68586 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -23,6 +23,7 @@
#include <QList>
#include <QStringList>
#include <QMetaType>
+#include <QAtomicInt>
class cmake;
@@ -78,7 +79,7 @@ public slots:
void generate();
/// set the property values
void setProperties(const QCMakePropertyList&);
- /// interrupt the configure or generate process
+ /// interrupt the configure or generate process (if connecting, make a direct connection)
void interrupt();
/// delete the cache in binary directory
void deleteCache();
@@ -133,6 +134,7 @@ signals:
protected:
cmake* CMakeInstance;
+ static bool interruptCallback(void*);
static void progressCallback(const char* msg, float percent, void* cd);
static void errorCallback(const char* msg, const char* title,
bool&, void* cd);
@@ -145,6 +147,7 @@ protected:
QString Generator;
QStringList AvailableGenerators;
QString CMakeExecutable;
+ QAtomicInt InterruptFlag;
};
#endif // __QCMake_h
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index bac2430..6dd8e5c 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -29,6 +29,7 @@ bool cmAddExecutableCommand
bool use_macbundle = false;
bool excludeFromAll = false;
bool importTarget = false;
+ bool importGlobal = false;
while ( s != args.end() )
{
if (*s == "WIN32")
@@ -51,6 +52,11 @@ bool cmAddExecutableCommand
++s;
importTarget = true;
}
+ else if(importTarget && *s == "GLOBAL")
+ {
+ ++s;
+ importGlobal = true;
+ }
else
{
break;
@@ -92,7 +98,8 @@ bool cmAddExecutableCommand
}
// Create the imported target.
- this->Makefile->AddImportedTarget(exename.c_str(), cmTarget::EXECUTABLE);
+ this->Makefile->AddImportedTarget(exename.c_str(), cmTarget::EXECUTABLE,
+ importGlobal);
return true;
}
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index f90e826..6834f58 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -92,12 +92,12 @@ public:
"\n"
"The add_executable command can also create IMPORTED executable "
"targets using this signature:\n"
- " add_executable(<name> IMPORTED)\n"
+ " add_executable(<name> IMPORTED [GLOBAL])\n"
"An IMPORTED executable target references an executable file located "
"outside the project. "
"No rules are generated to build it. "
"The target name has scope in the directory in which it is created "
- "and below. "
+ "and below, but the GLOBAL option extends visibility. "
"It may be referenced like any target built within the project. "
"IMPORTED executables are useful for convenient reference from "
"commands like add_custom_command. "
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index efa29e6..9a776fb 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -31,6 +31,7 @@ bool cmAddLibraryCommand
}
bool excludeFromAll = false;
bool importTarget = false;
+ bool importGlobal = false;
std::vector<std::string>::const_iterator s = args.begin();
@@ -79,6 +80,11 @@ bool cmAddLibraryCommand
++s;
importTarget = true;
}
+ else if(importTarget && *s == "GLOBAL")
+ {
+ ++s;
+ importGlobal = true;
+ }
else
{
break;
@@ -124,7 +130,7 @@ bool cmAddLibraryCommand
}
// Create the imported target.
- this->Makefile->AddImportedTarget(libName.c_str(), type);
+ this->Makefile->AddImportedTarget(libName.c_str(), type, importGlobal);
return true;
}
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 07fbb06..edca1bb 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -96,12 +96,13 @@ public:
"\n"
"The add_library command can also create IMPORTED library "
"targets using this signature:\n"
- " add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED)\n"
+ " add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED\n"
+ " [GLOBAL])\n"
"An IMPORTED library target references a library file located "
"outside the project. "
"No rules are generated to build it. "
"The target name has scope in the directory in which it is created "
- "and below. "
+ "and below, but the GLOBAL option extends visibility. "
"It may be referenced like any target built within the project. "
"IMPORTED libraries are useful for convenient reference from "
"commands like target_link_libraries. "
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 7817eb3..e046096 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -111,6 +111,17 @@ public:
}
/**
+ * This is used to avoid including this command
+ * in documentation. This is mainly used by
+ * cmMacroHelperCommand and cmFunctionHelperCommand
+ * which cannot provide appropriate documentation.
+ */
+ virtual bool ShouldAppearInDocumentation()
+ {
+ return true;
+ }
+
+ /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() = 0;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index edf6c35..57fd5b4 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -248,6 +248,10 @@ cmComputeLinkInformation
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
+ // Check whether to recognize OpenBSD-style library versioned names.
+ this->OpenBSD = this->Makefile->GetCMakeInstance()
+ ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING");
+
// The configuration being linked.
this->Config = config;
@@ -973,7 +977,15 @@ cmComputeLinkInformation
}
// Finish the list.
- libext += ")$";
+ libext += ")";
+
+ // Add an optional OpenBSD version component.
+ if(this->OpenBSD)
+ {
+ libext += "(\\.[0-9]+\\.[0-9]+)?";
+ }
+
+ libext += "$";
return libext;
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index bbeed68..f60f8d3 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -128,6 +128,7 @@ private:
cmsys::RegularExpression ExtractSharedLibraryName;
cmsys::RegularExpression ExtractAnyLibraryName;
std::string SharedRegexString;
+ bool OpenBSD;
void AddLinkPrefix(const char* p);
void AddLinkExtension(const char* e, LinkType type);
std::string CreateExtensionRegex(std::vector<std::string> const& exts);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index dca2fb3..7d84ba6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -26,6 +26,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* sourceDirectory = argv[2].c_str();
const char* projectName = 0;
const char* targetName = 0;
+ char targetNameBuf[64];
int extraArgs = 0;
// look for CMAKE_FLAGS and store them
@@ -281,16 +282,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmakeFlags.push_back(flag);
}
+ /* Use a random file name to avoid rapid creation and deletion
+ of the same executable name (some filesystems fail on that). */
+ sprintf(targetNameBuf, "cmTryCompileExec%u",
+ cmSystemTools::RandomSeed());
+ targetName = targetNameBuf;
+
/* Put the executable at a known location (for COPY_FILE). */
fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
- fprintf(fout,
- "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");
+ fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
+ fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
- targetName = "cmTryCompileExec";
// if the source is not in CMakeTmp
if(source.find("CMakeTmp") == source.npos)
{
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 687debc..1cab2b5 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -354,7 +354,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"If true, do not add run time path information.",
"If this is set to TRUE, then the rpath information "
"is not added to compiled executables. The default "
- "is to add rpath information if the platform supports it."
+ "is to add rpath information if the platform supports it. "
"This allows for easy running from the build tree.",false,
"Variables that Provide Information");
cm->DefineProperty
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 07683d0..904a157 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -14,7 +14,9 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
#include <cmsys/Directory.hxx>
+#include <cmsys/Glob.hxx>
+#include <algorithm>
//----------------------------------------------------------------------------
static const char *cmDocumentationStandardOptions[][3] =
@@ -220,55 +222,7 @@ cmDocumentation::cmDocumentation()
:CurrentFormatter(0)
{
this->SetForm(TextForm);
-
- cmDocumentationSection *sec;
-
- sec = new cmDocumentationSection("Author","AUTHOR");
- sec->Append(cmDocumentationEntry
- (0,
- "This manual page was generated by the \"--help-man\" option.",
- 0));
- this->AllSections["Author"] = sec;
-
- sec = new cmDocumentationSection("Copyright","COPYRIGHT");
- sec->Append(cmDocumentationCopyright);
- this->AllSections["Copyright"] = sec;
-
- sec = new cmDocumentationSection("See Also","SEE ALSO");
- sec->Append(cmDocumentationStandardSeeAlso);
- this->AllSections["Standard See Also"] = sec;
-
- sec = new cmDocumentationSection("Options","OPTIONS");
- sec->Append(cmDocumentationStandardOptions);
- this->AllSections["Options"] = sec;
-
- sec = new cmDocumentationSection("Properties","PROPERTIES");
- sec->Append(cmPropertiesDocumentationDescription);
- this->AllSections["Properties Description"] = sec;
-
- sec = new cmDocumentationSection("Generators","GENERATORS");
- sec->Append(cmDocumentationGeneratorsHeader);
- this->AllSections["Generators"] = sec;
-
- sec = new cmDocumentationSection("Compatibility Commands",
- "COMPATIBILITY COMMANDS");
- sec->Append(cmCompatCommandsDocumentationDescription);
- this->AllSections["Compatibility Commands"] = sec;
-
-
- this->PropertySections.push_back("Properties of Global Scope");
- this->PropertySections.push_back("Properties on Directories");
- this->PropertySections.push_back("Properties on Targets");
- this->PropertySections.push_back("Properties on Tests");
- this->PropertySections.push_back("Properties on Source Files");
- this->PropertySections.push_back("Properties on Cache Entries");
-
- this->VariableSections.push_back("Variables that Provide Information");
- this->VariableSections.push_back("Variables That Change Behavior");
- this->VariableSections.push_back("Variables That Describe the System");
- this->VariableSections.push_back("Variables that Control the Build");
- this->VariableSections.push_back("Variables for Languages");
-
+ this->addCommonStandardDocSections();
this->ShowGenerators = true;
}
@@ -559,6 +513,8 @@ bool cmDocumentation::CreateSingleModule(const char* fname,
{
if(line.size() && line[0] == '#')
{
+ /* line beginnings with ## are mark-up ignore them */
+ if (line.size()>=2 && line[1] == '#') continue;
// blank line
if(line.size() <= 2)
{
@@ -710,6 +666,423 @@ cmDocumentation::Form cmDocumentation::GetFormFromFilename(
}
//----------------------------------------------------------------------------
+void cmDocumentation::addCommonStandardDocSections()
+{
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Author","AUTHOR");
+ sec->Append(cmDocumentationEntry
+ (0,
+ "This manual page was generated by the \"--help-man\" option.",
+ 0));
+ this->AllSections["Author"] = sec;
+
+ sec = new cmDocumentationSection("Copyright","COPYRIGHT");
+ sec->Append(cmDocumentationCopyright);
+ this->AllSections["Copyright"] = sec;
+
+ sec = new cmDocumentationSection("See Also","SEE ALSO");
+ sec->Append(cmDocumentationStandardSeeAlso);
+ this->AllSections["Standard See Also"] = sec;
+
+ sec = new cmDocumentationSection("Options","OPTIONS");
+ sec->Append(cmDocumentationStandardOptions);
+ this->AllSections["Options"] = sec;
+
+ sec = new cmDocumentationSection("Compatibility Commands",
+ "COMPATIBILITY COMMANDS");
+ sec->Append(cmCompatCommandsDocumentationDescription);
+ this->AllSections["Compatibility Commands"] = sec;
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::addCMakeStandardDocSections()
+{
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Properties","PROPERTIES");
+ sec->Append(cmPropertiesDocumentationDescription);
+ this->AllSections["Properties Description"] = sec;
+
+ sec = new cmDocumentationSection("Generators","GENERATORS");
+ sec->Append(cmDocumentationGeneratorsHeader);
+ this->AllSections["Generators"] = sec;
+
+ this->PropertySections.push_back("Properties of Global Scope");
+ this->PropertySections.push_back("Properties on Directories");
+ this->PropertySections.push_back("Properties on Targets");
+ this->PropertySections.push_back("Properties on Tests");
+ this->PropertySections.push_back("Properties on Source Files");
+ this->PropertySections.push_back("Properties on Cache Entries");
+
+ this->VariableSections.push_back("Variables that Provide Information");
+ this->VariableSections.push_back("Variables That Change Behavior");
+ this->VariableSections.push_back("Variables That Describe the System");
+ this->VariableSections.push_back("Variables that Control the Build");
+ this->VariableSections.push_back("Variables for Languages");
+
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::addCTestStandardDocSections()
+{
+ // This is currently done for backward compatibility reason
+ // We may suppress some of these.
+ addCMakeStandardDocSections();
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::addCPackStandardDocSections()
+{
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Generators","GENERATORS");
+ sec->Append(cmDocumentationGeneratorsHeader);
+ this->AllSections["Generators"] = sec;
+
+ this->VariableSections.push_back(
+ "Variables common to all CPack generators");
+}
+
+void cmDocumentation::addAutomaticVariableSections(const std::string& section)
+{
+ std::vector<std::string>::iterator it;
+ it = std::find(this->VariableSections.begin(),
+ this->VariableSections.end(),
+ section);
+ /* if the section does not exist then add it */
+ if (it==this->VariableSections.end())
+ {
+ this->VariableSections.push_back(section);
+ }
+}
+//----------------------------------------------------------------------------
+int cmDocumentation::getDocumentedModulesListInDir(
+ std::string path,
+ std::string globExpr,
+ documentedModulesList_t& docedModuleList)
+{
+ cmsys::Glob gl;
+ std::string findExpr;
+ std::vector<std::string> files;
+ std::string line;
+ documentedModuleSectionPair_t docPair;
+ int nbDocumentedModules = 0;
+
+ findExpr = path + "/" + globExpr;
+ if (gl.FindFiles(findExpr))
+ {
+ files = gl.GetFiles();
+ for (std::vector<std::string>::iterator itf=files.begin();
+ itf!=files.end();++itf)
+ {
+ std::ifstream fin((*itf).c_str());
+ // file access trouble ignore it (ignore this kind of error)
+ if (!fin) continue;
+ /* read first line in order to get doc section */
+ if (cmSystemTools::GetLineFromStream(fin, line))
+ {
+ /* Doc section indicates that
+ * this file has structured doc in it.
+ */
+ if (line.find("##section")!=std::string::npos)
+ {
+ // ok found one more documented module
+ ++nbDocumentedModules;
+ docPair.first = *itf;
+ // 10 is the size of '##section' + 1
+ docPair.second = line.substr(10,std::string::npos);
+ docedModuleList.push_back(docPair);
+ }
+ // No else if no section is found (undocumented module)
+ }
+ // No else cannot read first line (ignore this kind of error)
+ line = "";
+ }
+ }
+ if (nbDocumentedModules>0)
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+//----------------------------------------------------------------------------
+static void trim(std::string& s)
+{
+ std::string::size_type pos = s.find_last_not_of(' ');
+ if(pos != std::string::npos)
+ {
+ s.erase(pos + 1);
+ pos = s.find_first_not_of(' ');
+ if(pos != std::string::npos) s.erase(0, pos);
+ }
+ else
+ {
+ s.erase(s.begin(), s.end());
+ }
+}
+
+int cmDocumentation::GetStructuredDocFromFile(
+ const char* fname,
+ std::vector<cmDocumentationEntry>& commands,
+ cmake* cm)
+{
+ typedef enum sdoce {
+ SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE,
+ SDOC_SECTION,
+ SDOC_UNKNOWN} sdoc_t;
+ int nbDocItemFound = 0;
+ int docCtxIdx = 0;
+ std::vector<int> docContextStack(60);
+ docContextStack[docCtxIdx]=SDOC_NONE;
+ cmDocumentationEntry e;
+ std::ifstream fin(fname);
+ if(!fin)
+ {
+ return nbDocItemFound;
+ }
+ std::string section;
+ std::string name;
+ std::string full;
+ std::string brief;
+ std::string line;
+ bool newCtx = false; /* we've just entered ##<beginkey> context */
+ bool inBrief = false; /* we are currently parsing brief desc. */
+ bool inFullFirstParagraph = false; /* we are currently parsing full
+ desc. first paragraph */
+ brief = "";
+ full = "";
+ bool newParagraph = true;
+ while ( fin && cmSystemTools::GetLineFromStream(fin, line) )
+ {
+ if(line.size() && line[0] == '#')
+ {
+ /* handle structured doc context */
+ if ((line.size()>=2) && line[1]=='#')
+ {
+ /* markup word is following '##' stopping at first space
+ * Some markup word like 'section' may have more characters
+ * following but we don't handle those here.
+ */
+ std::string mkword = line.substr(2,line.find(' ',2)-2);
+ if (mkword=="macro")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_MACRO;
+ newCtx = true;
+ }
+ else if (mkword=="variable")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_VARIABLE;
+ newCtx = true;
+ }
+ else if (mkword=="function")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_FUNCTION;
+ newCtx = true;
+ }
+ else if (mkword=="module")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_MODULE;
+ newCtx = true;
+ }
+ else if (mkword=="section")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_SECTION;
+ // 10 is the size of '##section' + 1
+ section = line.substr(10,std::string::npos);
+ /* drop the rest of the line */
+ line = "";
+ newCtx = true;
+ }
+ else if (mkword.substr(0,3)=="end")
+ {
+ switch (docContextStack[docCtxIdx]) {
+ case SDOC_MACRO:
+ /* for now MACRO and FUNCTION are handled in the same way */
+ case SDOC_FUNCTION:
+ commands.push_back(cmDocumentationEntry(name.c_str(),
+ brief.c_str(),full.c_str()));
+ break;
+ case SDOC_VARIABLE:
+ this->addAutomaticVariableSections(section);
+ cm->DefineProperty
+ (name.c_str(), cmProperty::VARIABLE,
+ brief.c_str(),
+ full.c_str(),false,
+ section.c_str());
+ break;
+ case SDOC_MODULE:
+ /* not implemented */
+ break;
+ case SDOC_SECTION:
+ /* not implemented */
+ break;
+ default:
+ /* ignore other cases */
+ break;
+ }
+ docCtxIdx--;
+ newCtx = false;
+ ++nbDocItemFound;
+ }
+ else
+ {
+ // error out unhandled context
+ return nbDocItemFound;
+ }
+ /* context is set go to next doc line */
+ continue;
+ }
+
+ // Now parse the text attached to the context
+
+ // The first line after the context mark-up contains::
+ // name - brief until. (brief is dot terminated or
+ // followed by a blank line)
+ if (newCtx)
+ {
+ // no brief (for easy variable definition)
+ if (line.find("-")==std::string::npos)
+ {
+ name = line.substr(1,std::string::npos);
+ trim(name);
+ brief = "";
+ inBrief = false;
+ full = "";
+ }
+ // here we have a name and brief beginning
+ else
+ {
+ name = line.substr(1,line.find("-")-1);
+ trim(name);
+ // we are parsing the brief context
+ brief = line.substr(line.find("-")+1,std::string::npos);
+ trim(brief);
+ // Brief may already be terminated on the first line
+ if (brief.find('.')!=std::string::npos)
+ {
+ inBrief = false;
+ full = brief.substr(brief.find('.')+1,std::string::npos);
+ trim(full);
+ inFullFirstParagraph = true;
+ brief = brief.substr(0,brief.find('.'));
+ }
+ // brief is continued on following lines
+ else
+ {
+ inBrief = true;
+ full = "";
+ }
+ }
+ newCtx = false;
+ continue;
+ }
+ // blank line
+ if(line.size() <= 2)
+ {
+ if (inBrief) {
+ inBrief = false;
+ full = "";
+ } else {
+ if (full.length()>0)
+ {
+ full += "\n";
+ }
+ // the first paragraph of full has ended
+ inFullFirstParagraph = false;
+ }
+ newParagraph = true;
+ }
+ // brief is terminated by '.'
+ else if (inBrief && (line.find('.')!=std::string::npos))
+ {
+ /* the brief just ended */
+ inBrief = false;
+ std::string endBrief = line.substr(1,line.find('.'));
+ trim(endBrief);
+ trim(brief);
+ brief += " " + endBrief;
+ full += line.substr(line.find('.')+1,std::string::npos);
+ trim(full);
+ inFullFirstParagraph = true;
+ }
+ // we handle full text or multi-line brief.
+ else
+ {
+ std::string* text;
+ if (inBrief)
+ {
+ text = &brief;
+ }
+ else
+ {
+ text = &full;
+ }
+ // two spaces
+ if(line[1] == ' ' && line[2] == ' ')
+ {
+ // there is no "full first paragraph at all."
+ if (line[3] == ' ')
+ {
+ inFullFirstParagraph = false;
+ }
+
+ if(!newParagraph && !inFullFirstParagraph)
+ {
+ *text += "\n";
+ newParagraph = true;
+ }
+ // Skip #, and leave space for pre-formatted
+ if (inFullFirstParagraph)
+ {
+ std::string temp = line.c_str()+1;
+ trim(temp);
+ *text += " " + temp;
+ }
+ else
+ {
+ *text += line.c_str()+1;
+ *text += "\n";
+ }
+ }
+ else if(line[1] == ' ')
+ {
+ if(!newParagraph)
+ {
+ *text += " ";
+ }
+ newParagraph = false;
+ // skip # and space
+ *text += line.c_str()+2;
+ }
+ else
+ {
+ if(!newParagraph)
+ {
+ *text += " ";
+ }
+ newParagraph = false;
+ // skip #
+ *text += line.c_str()+1;
+ }
+ }
+ }
+ /* next line is not the first context line */
+ newCtx = false;
+ }
+ return nbDocItemFound;
+}
+
+//----------------------------------------------------------------------------
bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
const char* exitOpt)
{
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 34b83b1..11bef16 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -21,6 +21,7 @@
#include "cmDocumentationFormatterText.h"
#include "cmDocumentationFormatterUsage.h"
#include "cmDocumentationSection.h"
+#include "cmake.h"
namespace cmsys
{
@@ -34,6 +35,21 @@ public:
cmDocumentation();
~cmDocumentation();
+
+ /**
+ * An helper type pair for [structured] documented modules.
+ * The comment of those module contains structure markup
+ * which makes it possible to retrieve the documentation
+ * of variables, macros and functions defined in the module.
+ * - first is the filename of the module
+ * - second is the section of the doc the module belongs too
+ */
+ typedef std::pair<std::string,std::string> documentedModuleSectionPair_t;
+ /**
+ * A list of documented module(s).
+ */
+ typedef std::list<documentedModuleSectionPair_t> documentedModulesList_t;
+
// High-level interface for standard documents:
/**
@@ -119,6 +135,60 @@ public:
static Form GetFormFromFilename(const std::string& filename);
+ /** Add common (to all tools) documentation section(s) */
+ void addCommonStandardDocSections();
+
+ /** Add the CMake standard documentation section(s) */
+ void addCMakeStandardDocSections();
+
+ /** Add the CTest standard documentation section(s) */
+ void addCTestStandardDocSections();
+
+ /** Add the CPack standard documentation section(s) */
+ void addCPackStandardDocSections();
+
+ /** Add automatic variables sections */
+ void addAutomaticVariableSections(const std::string& section);
+
+ /**
+ * Retrieve the list of documented module located in
+ * path which match the globing expression globExpr.
+ * @param[in] path, directory where to start the search
+ * we will recurse into it.
+ * @param[in] globExpr, the globing expression used to
+ * match the file in path.
+ * @param[out] the list of obtained pairs (may be empty)
+ * @return 0 on success 1 on error or empty list
+ */
+ int getDocumentedModulesListInDir(
+ std::string path,
+ std::string globExpr,
+ documentedModulesList_t& docModuleList);
+
+ /**
+ * Get the documentation of macros, functions and variable documented
+ * with CMake structured documentation in a CMake script.
+ * (in fact it may be in any file which follow the structured doc format)
+ * Structured documentation begin with
+ * ## (double sharp) in column 1 & 2 immediately followed
+ * by a markup. Those ## are ignored by the legacy module
+ * documentation parser @see CreateSingleModule.
+ * Current markup are ##section, ##module,
+ * ##macro, ##function, ##variable and ##end.
+ * ##end is closing either of the previous ones.
+ * @param[in] fname the script file name to be parsed for documentation
+ * @param[in,out] commands the vector of command/macros documentation
+ * entry found in the script file.
+ * @param[in,out] the cmake object instance to which variable documentation
+ * will be attached (using @see cmake::DefineProperty)
+ * @param[in] the documentation section in which the property will be
+ * inserted.
+ * @return the number of documented items (command and variable)
+ * found in the file.
+ */
+ int GetStructuredDocFromFile(const char* fname,
+ std::vector<cmDocumentationEntry>& commands,
+ cmake* cm);
private:
void SetForm(Form f);
void SetDocName(const char* docname);
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 2fa2cca..a726849 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -354,13 +354,23 @@ void cmFindLibraryHelper::RegexFromList(std::string& out,
//----------------------------------------------------------------------------
bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
{
- // Check if the given name ends in a valid library suffix.
for(std::vector<std::string>::const_iterator si = this->Suffixes.begin();
si != this->Suffixes.end(); ++si)
{
- std::string const& suffix = *si;
- if(name.length() > suffix.length() &&
- name.substr(name.size()-suffix.length()) == suffix)
+ std::string suffix = *si;
+ if(name.length() <= suffix.length())
+ {
+ continue;
+ }
+ // Check if the given name ends in a valid library suffix.
+ if(name.substr(name.size()-suffix.length()) == suffix)
+ {
+ return true;
+ }
+ // Check if a valid library suffix is somewhere in the name,
+ // this may happen e.g. for versioned shared libraries: libfoo.so.2
+ suffix += ".";
+ if(name.find(suffix) != name.npos)
{
return true;
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7d3f09b..22bb628 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1226,6 +1226,15 @@ void cmFindPackageCommand::AppendSuccessInformation()
}
this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(),
versionInfo.c_str());
+ if (this->Required)
+ {
+ std::string requiredInfoPropName = "_CMAKE_";
+ requiredInfoPropName += this->Name;
+ requiredInfoPropName += "_TYPE";
+ this->Makefile->GetCMakeInstance()->SetProperty(
+ requiredInfoPropName.c_str(), "REQUIRED");
+ }
+
// Restore original state of "_FIND_" variables we set.
this->RestoreFindDefinitions();
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index ec4fd16..7a80a1c 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -23,6 +23,17 @@ public:
~cmFunctionHelperCommand() {};
/**
+ * This is used to avoid including this command
+ * in documentation. This is mainly used by
+ * cmMacroHelperCommand and cmFunctionHelperCommand
+ * which cannot provide appropriate documentation.
+ */
+ virtual bool ShouldAppearInDocumentation()
+ {
+ return false;
+ }
+
+ /**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 124519a..8dce053 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1666,6 +1666,11 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name)
{
return i->second;
}
+ i = this->ImportedTargets.find(name);
+ if ( i != this->ImportedTargets.end() )
+ {
+ return i->second;
+ }
}
return 0;
}
@@ -2046,10 +2051,16 @@ cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target)
return this->TargetDependencies[&target];
}
-void cmGlobalGenerator::AddTarget(cmTargets::value_type &v)
+void cmGlobalGenerator::AddTarget(cmTarget* t)
{
- assert(!v.second.IsImported());
- this->TotalTargets[v.first] = &v.second;
+ if(t->IsImported())
+ {
+ this->ImportedTargets[t->GetName()] = t;
+ }
+ else
+ {
+ this->TotalTargets[t->GetName()] = t;
+ }
}
void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ded3345..1a0e41a 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -230,7 +230,7 @@ public:
std::set<cmStdString> const& GetDirectoryContent(std::string const& dir,
bool needDisk = true);
- void AddTarget(cmTargets::value_type &v);
+ void AddTarget(cmTarget* t);
virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
virtual const char* GetInstallTargetName() const { return "INSTALL"; }
@@ -333,6 +333,7 @@ protected:
// All targets in the entire project.
std::map<cmStdString,cmTarget *> TotalTargets;
+ std::map<cmStdString,cmTarget *> ImportedTargets;
virtual const char* GetPredefinedTargetsFolder();
virtual bool UseFolderProperty();
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 22ba28f..4eed477 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -910,6 +910,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
if (newArgs.size() != 1)
{
errorString = "Unknown arguments specified";
+ status = cmake::FATAL_ERROR;
return false;
}
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 14deb24..dca528d 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -350,33 +350,33 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
targetIt!=targetList.GetVector().end();
++targetIt)
{
- // Lookup this target in the current directory.
- if(cmTarget* target=this->Makefile->FindTarget(targetIt->c_str()))
- {
- // Found the target. Check its type.
- if(target->GetType() != cmTarget::EXECUTABLE &&
- target->GetType() != cmTarget::STATIC_LIBRARY &&
- target->GetType() != cmTarget::SHARED_LIBRARY &&
- target->GetType() != cmTarget::MODULE_LIBRARY)
- {
- cmOStringStream e;
- e << "TARGETS given target \"" << (*targetIt)
- << "\" which is not an executable, library, or module.";
- this->SetError(e.str().c_str());
- return false;
- }
- // Store the target in the list to be installed.
- targets.push_back(target);
- }
- else
+ // Lookup this target in the current directory.
+ if(cmTarget* target=this->Makefile->FindTarget(targetIt->c_str()))
+ {
+ // Found the target. Check its type.
+ if(target->GetType() != cmTarget::EXECUTABLE &&
+ target->GetType() != cmTarget::STATIC_LIBRARY &&
+ target->GetType() != cmTarget::SHARED_LIBRARY &&
+ target->GetType() != cmTarget::MODULE_LIBRARY)
{
- // Did not find the target.
cmOStringStream e;
e << "TARGETS given target \"" << (*targetIt)
- << "\" which does not exist in this directory.";
+ << "\" which is not an executable, library, or module.";
this->SetError(e.str().c_str());
return false;
}
+ // Store the target in the list to be installed.
+ targets.push_back(target);
+ }
+ else
+ {
+ // Did not find the target.
+ cmOStringStream e;
+ e << "TARGETS given target \"" << (*targetIt)
+ << "\" which does not exist in this directory.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
}
// Keep track of whether we will be performing an installation of
@@ -602,98 +602,98 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
break;
}
- // These well-known sets of files are installed *automatically* for FRAMEWORK
- // SHARED library targets on the Mac as part of installing the FRAMEWORK.
- // For other target types or on other platforms, they are not installed
- // automatically and so we need to create install files generators for them.
- //
- bool createInstallGeneratorsForTargetFileSets = true;
-
- if(target.IsFrameworkOnApple())
- {
- createInstallGeneratorsForTargetFileSets = false;
- }
+ // These well-known sets of files are installed *automatically* for
+ // FRAMEWORK SHARED library targets on the Mac as part of installing the
+ // FRAMEWORK. For other target types or on other platforms, they are not
+ // installed automatically and so we need to create install files
+ // generators for them.
+ bool createInstallGeneratorsForTargetFileSets = true;
- if(createInstallGeneratorsForTargetFileSets && !namelinkOnly)
- {
- const char* files = target.GetProperty("PRIVATE_HEADER");
- if ((files) && (*files))
+ if(target.IsFrameworkOnApple())
{
- std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
- std::vector<std::string> absFiles;
- if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles))
- {
- return false;
- }
-
- // Create the files install generator.
- if (!privateHeaderArgs.GetDestination().empty())
- {
- privateHeaderGenerator = CreateInstallFilesGenerator(absFiles,
- privateHeaderArgs, false);
- }
- else
- {
- cmOStringStream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
- << "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
- cmSystemTools::Message(e.str().c_str(), "Warning");
- }
+ createInstallGeneratorsForTargetFileSets = false;
}
- files = target.GetProperty("PUBLIC_HEADER");
- if ((files) && (*files))
+ if(createInstallGeneratorsForTargetFileSets && !namelinkOnly)
{
- std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
- std::vector<std::string> absFiles;
- if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles))
+ const char* files = target.GetProperty("PRIVATE_HEADER");
+ if ((files) && (*files))
{
- return false;
- }
+ std::vector<std::string> relFiles;
+ cmSystemTools::ExpandListArgument(files, relFiles);
+ std::vector<std::string> absFiles;
+ if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles))
+ {
+ return false;
+ }
- // Create the files install generator.
- if (!publicHeaderArgs.GetDestination().empty())
- {
- publicHeaderGenerator = CreateInstallFilesGenerator(absFiles,
- publicHeaderArgs, false);
- }
- else
- {
- cmOStringStream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
- << "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
- cmSystemTools::Message(e.str().c_str(), "Warning");
+ // Create the files install generator.
+ if (!privateHeaderArgs.GetDestination().empty())
+ {
+ privateHeaderGenerator =
+ CreateInstallFilesGenerator(absFiles, privateHeaderArgs, false);
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ << "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
+ cmSystemTools::Message(e.str().c_str(), "Warning");
+ }
}
- }
- files = target.GetProperty("RESOURCE");
- if ((files) && (*files))
- {
- std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
- std::vector<std::string> absFiles;
- if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles))
+ files = target.GetProperty("PUBLIC_HEADER");
+ if ((files) && (*files))
{
- return false;
- }
+ std::vector<std::string> relFiles;
+ cmSystemTools::ExpandListArgument(files, relFiles);
+ std::vector<std::string> absFiles;
+ if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles))
+ {
+ return false;
+ }
- // Create the files install generator.
- if (!resourceArgs.GetDestination().empty())
- {
- resourceGenerator = CreateInstallFilesGenerator(absFiles,
- resourceArgs, false);
+ // Create the files install generator.
+ if (!publicHeaderArgs.GetDestination().empty())
+ {
+ publicHeaderGenerator =
+ CreateInstallFilesGenerator(absFiles, publicHeaderArgs, false);
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ << "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
+ cmSystemTools::Message(e.str().c_str(), "Warning");
+ }
}
- else
+
+ files = target.GetProperty("RESOURCE");
+ if ((files) && (*files))
{
- cmOStringStream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
- << "RESOURCE files but no RESOURCE DESTINATION.";
- cmSystemTools::Message(e.str().c_str(), "Warning");
+ std::vector<std::string> relFiles;
+ cmSystemTools::ExpandListArgument(files, relFiles);
+ std::vector<std::string> absFiles;
+ if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles))
+ {
+ return false;
+ }
+
+ // Create the files install generator.
+ if (!resourceArgs.GetDestination().empty())
+ {
+ resourceGenerator = CreateInstallFilesGenerator(absFiles,
+ resourceArgs, false);
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ << "RESOURCE files but no RESOURCE DESTINATION.";
+ cmSystemTools::Message(e.str().c_str(), "Warning");
+ }
}
}
- }
// Keep track of whether we're installing anything in each category
installsArchive = installsArchive || archiveGenerator != 0;
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 8f62322..377b43a 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -168,9 +168,7 @@ public:
"On non-DLL platforms mySharedLib will be installed to <prefix>/lib "
"and /some/full/path. On DLL platforms the mySharedLib DLL will be "
"installed to <prefix>/bin and /some/full/path and its import library "
- "will be installed to <prefix>/lib/static and /some/full/path. "
- "On non-DLL platforms mySharedLib will be installed to <prefix>/lib "
- "and /some/full/path."
+ "will be installed to <prefix>/lib/static and /some/full/path."
"\n"
"The EXPORT option associates the installed target files with an "
"export called <export-name>. "
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 70dcfd5..dd313ca 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -562,6 +562,21 @@ cmLocalUnixMakefileGenerator3
space = " ";
}
+ // Warn about paths not supported by Make tools.
+ std::string::size_type pos = tgt.find_first_of("=");
+ if(pos != std::string::npos)
+ {
+ cmOStringStream m;
+ m <<
+ "Make rule for\n"
+ " " << tgt << "\n"
+ "has '=' on left hand side. "
+ "The make tool may not support this.";
+ cmListFileBacktrace bt;
+ this->GlobalGenerator->GetCMakeInstance()
+ ->IssueMessage(cmake::WARNING, m.str(), bt);
+ }
+
// Mark the rule as symbolic if requested.
if(symbolic)
{
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 774f32b..f81a63d 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -23,6 +23,17 @@ public:
~cmMacroHelperCommand() {};
/**
+ * This is used to avoid including this command
+ * in documentation. This is mainly used by
+ * cmMacroHelperCommand and cmFunctionHelperCommand
+ * which cannot provide appropriate documentation.
+ */
+ virtual bool ShouldAppearInDocumentation()
+ {
+ return false;
+ }
+
+ /**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7939d73..fdf5b31 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1937,7 +1937,7 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name)
cmTarget& target = it->second;
target.SetType(type, name);
target.SetMakefile(this);
- this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it);
+ this->LocalGenerator->GetGlobalGenerator()->AddTarget(&it->second);
return &it->second;
}
@@ -3894,7 +3894,8 @@ void cmMakefile::DefineProperties(cmake *cm)
//----------------------------------------------------------------------------
cmTarget*
-cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type)
+cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
+ bool global)
{
// Create the target.
cmsys::auto_ptr<cmTarget> target(new cmTarget);
@@ -3904,6 +3905,10 @@ cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type)
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();
+ if(global)
+ {
+ this->LocalGenerator->GetGlobalGenerator()->AddTarget(target.get());
+ }
// Transfer ownership to this cmMakefile object.
this->ImportedTargetsOwned.push_back(target.get());
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1236787..1c46a73 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -203,7 +203,8 @@ public:
void RemoveDefineFlag(const char* definition);
/** Create a new imported target with the name and type given. */
- cmTarget* AddImportedTarget(const char* name, cmTarget::TargetType type);
+ cmTarget* AddImportedTarget(const char* name, cmTarget::TargetType type,
+ bool global);
cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 02060ca..15e689b 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -131,6 +131,8 @@ void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
void (*cmSystemTools::s_StdoutCallback)(const char*, int len, void*);
void* cmSystemTools::s_ErrorCallbackClientData = 0;
void* cmSystemTools::s_StdoutCallbackClientData = 0;
+bool (*cmSystemTools::s_InterruptCallback)(void*);
+void* cmSystemTools::s_InterruptCallbackClientData = 0;
// replace replace with with as many times as it shows up in source.
// write the result into source.
@@ -220,6 +222,20 @@ void cmSystemTools::Error(const char* m1, const char* m2,
cmSystemTools::Message(message.c_str(),"Error");
}
+void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData)
+{
+ s_InterruptCallback = f;
+ s_InterruptCallbackClientData = clientData;
+}
+
+bool cmSystemTools::GetInterruptFlag()
+{
+ if(s_InterruptCallback)
+ {
+ return (*s_InterruptCallback)(s_InterruptCallbackClientData);
+ }
+ return false;
+}
void cmSystemTools::SetErrorCallback(ErrorCallback f, void* clientData)
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 2137340..7afc701 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -78,6 +78,11 @@ public:
///! Send a string to stderr. Stdout callbacks will not be invoced.
static void Stderr(const char* s, int length);
+
+ typedef bool (*InterruptCallback)(void*);
+ static void SetInterruptCallback(InterruptCallback f, void* clientData=0);
+ static bool GetInterruptFlag();
+
///! Return true if there was an error at any point.
static bool GetErrorOccuredFlag()
{
@@ -96,7 +101,7 @@ public:
///! Return true if there was an error at any point.
static bool GetFatalErrorOccured()
{
- return cmSystemTools::s_FatalErrorOccured;
+ return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag();
}
///! Set the error occured flag and fatal error back to false
@@ -467,8 +472,10 @@ private:
static bool s_DisableRunCommandOutput;
static ErrorCallback s_ErrorCallback;
static StdoutCallback s_StdoutCallback;
+ static InterruptCallback s_InterruptCallback;
static void* s_ErrorCallbackClientData;
static void* s_StdoutCallbackClientData;
+ static void* s_InterruptCallbackClientData;
static std::string s_Windows9xComspecSubstitute;
};
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6a937b8..0c79b30 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -323,7 +323,8 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_CONFIGURATIONS", cmProperty::TARGET,
"Configurations provided for an IMPORTED target.",
- "Lists configuration names available for an IMPORTED target. "
+ "Set this to the list of configuration names available for an "
+ "IMPORTED target. "
"The names correspond to configurations defined in the project from "
"which the target is imported. "
"If the importing project uses a different set of configurations "
@@ -334,14 +335,12 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_IMPLIB", cmProperty::TARGET,
"Full path to the import library for an IMPORTED target.",
- "Specifies the location of the \".lib\" part of a windows DLL. "
+ "Set this to the location of the \".lib\" part of a windows DLL. "
"Ignored for non-imported targets.");
cm->DefineProperty
("IMPORTED_IMPLIB_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_IMPLIB property.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_IMPLIB property.",
"Configuration names correspond to those provided by the project "
"from which the target is imported.");
@@ -351,8 +350,10 @@ void cmTarget::DefineProperties(cmake *cm)
"Shared libraries may be linked to other shared libraries as part "
"of their implementation. On some platforms the linker searches "
"for the dependent libraries of shared libraries they are including "
- "in the link. This property lists "
- "the dependent shared libraries of an imported library. The list "
+ "in the link. "
+ "Set this property to the list of dependent shared libraries of an "
+ "imported library. "
+ "The list "
"should be disjoint from the list of interface libraries in the "
"IMPORTED_LINK_INTERFACE_LIBRARIES property. On platforms requiring "
"dependent shared libraries to be found at link time CMake uses this "
@@ -361,9 +362,7 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_LINK_DEPENDENT_LIBRARIES.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_LINK_DEPENDENT_LIBRARIES.",
"Configuration names correspond to those provided by the project "
"from which the target is imported. "
"If set, this property completely overrides the generic property "
@@ -372,8 +371,8 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LIBRARIES", cmProperty::TARGET,
"Transitive link interface of an IMPORTED target.",
- "Lists libraries whose interface is included when an IMPORTED library "
- "target is linked to another target. "
+ "Set this to the list of libraries whose interface is included when "
+ "an IMPORTED library target is linked to another target. "
"The libraries will be included on the link line for the target. "
"Unlike the LINK_INTERFACE_LIBRARIES property, this property applies "
"to all imported target types, including STATIC libraries. "
@@ -381,9 +380,7 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_LINK_INTERFACE_LIBRARIES.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LIBRARIES.",
"Configuration names correspond to those provided by the project "
"from which the target is imported. "
"If set, this property completely overrides the generic property "
@@ -392,8 +389,8 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LANGUAGES", cmProperty::TARGET,
"Languages compiled into an IMPORTED static library.",
- "Lists languages of soure files compiled to produce a STATIC IMPORTED "
- "library (such as \"C\" or \"CXX\"). "
+ "Set this to the list of languages of source files compiled to "
+ "produce a STATIC IMPORTED library (such as \"C\" or \"CXX\"). "
"CMake accounts for these languages when computing how to link a "
"target to the imported library. "
"For example, when a C executable links to an imported C++ static "
@@ -405,9 +402,7 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_LINK_INTERFACE_LANGUAGES.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LANGUAGES.",
"Configuration names correspond to those provided by the project "
"from which the target is imported. "
"If set, this property completely overrides the generic property "
@@ -419,16 +414,14 @@ void cmTarget::DefineProperties(cmake *cm)
"This is LINK_INTERFACE_MULTIPLICITY for IMPORTED targets.");
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_MULTIPLICITY_<CONFIG>", cmProperty::TARGET,
- "Per-configuration repetition count for cycles of IMPORTED archives.",
- "This is the configuration-specific version of "
- "IMPORTED_LINK_INTERFACE_MULTIPLICITY. "
+ "<CONFIG>-specific version of IMPORTED_LINK_INTERFACE_MULTIPLICITY.",
"If set, this property completely overrides the generic property "
"for the named configuration.");
cm->DefineProperty
("IMPORTED_LOCATION", cmProperty::TARGET,
"Full path to the main file on disk for an IMPORTED target.",
- "Specifies the location of an IMPORTED target file on disk. "
+ "Set this to the location of an IMPORTED target file on disk. "
"For executables this is the location of the executable file. "
"For bundles on OS X this is the location of the executable file "
"inside Contents/MacOS under the application bundle folder. "
@@ -440,28 +433,29 @@ void cmTarget::DefineProperties(cmake *cm)
"symlink just inside the framework folder. "
"For DLLs this is the location of the \".dll\" part of the library. "
"For UNKNOWN libraries this is the location of the file to be linked. "
- "Ignored for non-imported targets.");
+ "Ignored for non-imported targets."
+ "\n"
+ "Projects may skip IMPORTED_LOCATION if the configuration-specific "
+ "property IMPORTED_LOCATION_<CONFIG> is set. "
+ "To get the location of an imported target read one of the "
+ "LOCATION or LOCATION_<CONFIG> properties.");
cm->DefineProperty
("IMPORTED_LOCATION_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_LOCATION property.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_LOCATION property.",
"Configuration names correspond to those provided by the project "
"from which the target is imported.");
cm->DefineProperty
("IMPORTED_SONAME", cmProperty::TARGET,
"The \"soname\" of an IMPORTED target of shared library type.",
- "Specifies the \"soname\" embedded in an imported shared library. "
+ "Set this to the \"soname\" embedded in an imported shared library. "
"This is meaningful only on platforms supporting the feature. "
"Ignored for non-imported targets.");
cm->DefineProperty
("IMPORTED_SONAME_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_SONAME property.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_SONAME property.",
"Configuration names correspond to those provided by the project "
"from which the target is imported.");
@@ -477,9 +471,7 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("IMPORTED_NO_SONAME_<CONFIG>", cmProperty::TARGET,
- "Per-configuration version of IMPORTED_NO_SONAME property.",
- "This property is used when loading settings for the <CONFIG> "
- "configuration of an imported target. "
+ "<CONFIG>-specific version of IMPORTED_NO_SONAME property.",
"Configuration names correspond to those provided by the project "
"from which the target is imported.");
@@ -685,8 +677,8 @@ void cmTarget::DefineProperties(cmake *cm)
cm->DefineProperty
("MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::TARGET,
"Map from project configuration to IMPORTED target's configuration.",
- "List configurations of an imported target that may be used for "
- "the current project's <CONFIG> configuration. "
+ "Set this to the list of configurations of an imported target that "
+ "may be used for the current project's <CONFIG> configuration. "
"Targets imported from another project may not provide the same set "
"of configuration names available in the current project. "
"Setting this property tells CMake what imported configurations are "
@@ -1055,10 +1047,10 @@ void cmTarget::DefineProperties(cmake *cm)
"Can be set to one or more UUIDs recognized by Visual Studio "
"to indicate the type of project. This value is copied "
"verbatim into the generated project file. Example for a "
- "managed C++ unit testing project: \""
- "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
- "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are "
- "semicolon-delimited.");
+ "managed C++ unit testing project:\n"
+ " {3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
+ "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\n"
+ "UUIDs are semicolon-delimited.");
cm->DefineProperty
("VS_GLOBAL_KEYWORD", cmProperty::TARGET,
"Visual Studio project keyword.",
@@ -1073,6 +1065,16 @@ void cmTarget::DefineProperties(cmake *cm)
"generated Visual Studio project. For example, \"System;"
"System.Windows.Forms\".");
cm->DefineProperty
+ ("VS_WINRT_EXTENSIONS", cmProperty::TARGET,
+ "Visual Studio project C++/CX language extensions for Windows Runtime",
+ "Can be set to enable C++/CX language extensions.");
+ cm->DefineProperty
+ ("VS_WINRT_REFERENCES", cmProperty::TARGET,
+ "Visual Studio project Windows Runtime Metadata references",
+ "Adds one or more semicolon-delimited WinRT references to a "
+ "generated Visual Studio project. For example, \"Windows;"
+ "Windows.UI.Core\".");
+ cm->DefineProperty
("VS_GLOBAL_<variable>", cmProperty::TARGET,
"Visual Studio project-specific global variable.",
"Tell the Visual Studio generator to set the global variable "
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 449adc1..9418761 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -255,6 +255,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteObjSources();
this->WriteCLSources();
this->WriteDotNetReferences();
+ this->WriteWinRTReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -268,33 +269,49 @@ void cmVisualStudio10TargetGenerator::Generate()
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
{
- const char* vsDotNetReferences
- = this->Target->GetProperty("VS_DOTNET_REFERENCES");
- if(vsDotNetReferences)
+ std::vector<std::string> references;
+ if(const char* vsDotNetReferences =
+ this->Target->GetProperty("VS_DOTNET_REFERENCES"))
+ {
+ cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
+ }
+ if(!references.empty())
{
- std::string references(vsDotNetReferences);
- std::string::size_type position = 0;
-
this->WriteString("<ItemGroup>\n", 1);
- while(references.length() > 0)
+ for(std::vector<std::string>::iterator ri = references.begin();
+ ri != references.end(); ++ri)
{
- if((position = references.find(";")) == std::string::npos)
- {
- position = references.length() + 1;
- }
-
this->WriteString("<Reference Include=\"", 2);
- (*this->BuildFileStream) <<
- cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
this->WriteString("<CopyLocalSatelliteAssemblies>true"
"</CopyLocalSatelliteAssemblies>\n", 3);
this->WriteString("<ReferenceOutputAssembly>true"
"</ReferenceOutputAssembly>\n", 3);
this->WriteString("</Reference>\n", 2);
-
- references.erase(0, position + 1);
}
+ this->WriteString("</ItemGroup>\n", 1);
+ }
+}
+void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
+{
+ std::vector<std::string> references;
+ if(const char* vsWinRTReferences =
+ this->Target->GetProperty("VS_WINRT_REFERENCES"))
+ {
+ cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
+ }
+ if(!references.empty())
+ {
+ this->WriteString("<ItemGroup>\n", 1);
+ for(std::vector<std::string>::iterator ri = references.begin();
+ ri != references.end(); ++ri)
+ {
+ this->WriteString("<Reference Include=\"", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
+ this->WriteString("<IsWinMDFile>true</IsWinMDFile>\n", 3);
+ this->WriteString("</Reference>\n", 2);
+ }
this->WriteString("</ItemGroup>\n", 1);
}
}
@@ -372,7 +389,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
this->WriteString(mfcLine.c_str(), 2);
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
- this->ClOptions[*i]->UsingUnicode())
+ this->ClOptions[*i]->UsingUnicode() ||
+ this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -387,6 +405,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<Immersive>true</Immersive>\n", 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 6702509..90035f2 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -48,6 +48,7 @@ private:
void WriteProjectConfigurationValues();
void WriteCLSources();
void WriteDotNetReferences();
+ void WriteWinRTReferences();
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index d691f46..cce5080 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2126,32 +2126,8 @@ int cmake::Configure()
}
-bool cmake::RejectUnsupportedPaths(const char* desc, std::string const& path)
-{
- // Some characters are not well-supported by native build systems.
- std::string::size_type pos = path.find_first_of("=");
- if(pos == std::string::npos)
- {
- return false;
- }
- cmOStringStream e;
- e << "The path to the " << desc << " directory:\n"
- << " " << path << "\n"
- << "contains unsupported character '" << path[pos] << "'.\n"
- << "Please use a different " << desc << " directory name.";
- cmListFileBacktrace bt;
- this->IssueMessage(cmake::FATAL_ERROR, e.str(), bt);
- return true;
-}
-
int cmake::ActualConfigure()
{
- if(this->RejectUnsupportedPaths("source", this->cmHomeDirectory) ||
- this->RejectUnsupportedPaths("binary", this->HomeOutputDirectory))
- {
- return 1;
- }
-
// Construct right now our path conversion table before it's too late:
this->UpdateConversionPathTable();
this->CleanupCommandsAndMacros();
@@ -2204,8 +2180,11 @@ int cmake::ActualConfigure()
std::string installedCompiler;
// Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified
- std::string vsregBase =
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
+ const std::string vsregBase =
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
+ std::vector<std::string> vsVerions;
+ vsVerions.push_back("VisualStudio\\");
+ vsVerions.push_back("VCExpress\\");
struct VSRegistryEntryName
{
const char* MSVersion;
@@ -2219,14 +2198,18 @@ int cmake::ActualConfigure()
{"9.0", "Visual Studio 9 2008"},
{"10.0", "Visual Studio 10"},
{0, 0}};
- for(int i =0; version[i].MSVersion != 0; i++)
+ for(size_t b=0; b < vsVerions.size() && installedCompiler.empty(); b++)
{
- std::string reg = vsregBase + version[i].MSVersion;
- reg += ";InstallDir]";
- cmSystemTools::ExpandRegistryValues(reg);
- if (!(reg == "/registry"))
+ for(int i =0; version[i].MSVersion != 0; i++)
{
- installedCompiler = version[i].GeneratorName;
+ std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
+ reg += ";InstallDir]";
+ cmSystemTools::ExpandRegistryValues(reg,
+ cmSystemTools::KeyWOW64_32);
+ if (!(reg == "/registry"))
+ {
+ installedCompiler = version[i].GeneratorName;
+ }
}
}
cmGlobalGenerator* gen
@@ -2677,7 +2660,9 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
j != this->Commands.end(); ++j)
{
if ((( withCompatCommands == false) && ( (*j).second->IsDiscouraged()))
- || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged())))
+ || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged()))
+ || (!((*j).second->ShouldAppearInDocumentation()))
+ )
{
continue;
}
diff --git a/Source/cmake.h b/Source/cmake.h
index ae56e85..31b1bb7 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -468,8 +468,6 @@ protected:
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
std::string FindCMakeProgram(const char* name) const;
-
- bool RejectUnsupportedPaths(const char* desc, std::string const& path);
private:
cmake(const cmake&); // Not implemented.
void operator=(const cmake&); // Not implemented.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 436236d..c3de8ca 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -355,6 +355,7 @@ int do_cmake(int ac, char** av)
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDocumentation doc;
+ doc.addCMakeStandardDocSections();
if(doc.CheckOptions(ac, av, "-E") || nocwd)
{
// Construct and print requested documentation.
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 85cecea..d41627e 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -291,6 +291,7 @@ int main (int argc, char *argv[])
<< "*********************************" << std::endl);
}
cmDocumentation doc;
+ doc.addCTestStandardDocSections();
if(doc.CheckOptions(argc, argv) || nocwd)
{
// Construct and print requested documentation.
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 4625ed1..e1ef1f8 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2012)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 01)
+SET(KWSYS_DATE_STAMP_MONTH 02)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 18)
+SET(KWSYS_DATE_STAMP_DAY 21)
diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt
index 6209c8f..8f24afe 100644
--- a/Tests/BundleUtilities/CMakeLists.txt
+++ b/Tests/BundleUtilities/CMakeLists.txt
@@ -82,3 +82,52 @@ add_custom_target(testbundleutils2_test ALL
DEPENDS testbundleutils1 module2
)
add_dependencies(testbundleutils2_test testbundleutils2)
+
+
+if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0)
+###### Test a Bundle application using dependencies
+###### and @rpaths on Mac OS X 10.5 or greater
+
+ # a shared library
+ add_library(shared-3 SHARED shared.cpp shared.h)
+
+ # another shared library
+ add_library(shared2-3 SHARED shared2.cpp shared2.h)
+
+ # a framework library
+ add_library(framework-3 SHARED framework.cpp framework.h)
+ set_target_properties(framework-3 PROPERTIES FRAMEWORK 1)
+
+ # build dependencies with @rpath install name
+ set_target_properties(shared-3 shared2-3 framework-3 PROPERTIES
+ INSTALL_NAME_DIR "@rpath"
+ BUILD_WITH_INSTALL_RPATH 1)
+
+ # a loadable module (depends on shared2)
+ # testbundleutils1 will load this at runtime
+ add_library(module3 MODULE module.cpp module.h)
+ set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/")
+ get_target_property(module_loc module3 LOCATION)
+ target_link_libraries(module3 shared2-3)
+
+ # a non-bundle application
+ add_executable(testbundleutils3 testbundleutils3.cpp)
+ target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS})
+ get_target_property(loc testbundleutils3 LOCATION)
+
+ set_target_properties(testbundleutils3 module3 PROPERTIES
+ LINK_FLAGS "-Wl,-rpath,@loader_path/")
+
+ # add custom target to install and test the app
+ add_custom_target(testbundleutils3_test ALL
+ COMMAND ${CMAKE_COMMAND}
+ "-DINPUT=${loc}"
+ "-DMODULE=${module_loc}"
+ "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
+ "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"
+ DEPENDS testbundleutils3 module3
+ )
+
+ add_dependencies(testbundleutils3_test testbundleutils3)
+endif()
diff --git a/Tests/BundleUtilities/testbundleutils3.cpp b/Tests/BundleUtilities/testbundleutils3.cpp
new file mode 100644
index 0000000..9df13e9
--- /dev/null
+++ b/Tests/BundleUtilities/testbundleutils3.cpp
@@ -0,0 +1,33 @@
+
+#include "framework.h"
+#include "shared.h"
+#include "stdio.h"
+
+#if defined(WIN32)
+#include <windows.h>
+#else
+#include "dlfcn.h"
+#endif
+
+int main(int, char**)
+{
+ framework();
+ shared();
+
+#if defined(WIN32)
+ HANDLE lib = LoadLibraryA("module3.dll");
+ if(!lib)
+ {
+ printf("Failed to open module3\n");
+ }
+#else
+ void* lib = dlopen("module3.so", RTLD_LAZY);
+ if(!lib)
+ {
+ printf("Failed to open module3\n%s\n", dlerror());
+ }
+#endif
+
+
+ return lib == 0 ? 1 : 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depC.cpp b/Tests/CMakeCommands/target_link_libraries/depC.cpp
index 93410a8..60bed59 100644
--- a/Tests/CMakeCommands/target_link_libraries/depC.cpp
+++ b/Tests/CMakeCommands/target_link_libraries/depC.cpp
@@ -10,4 +10,4 @@ DepA DepC::getA()
{
DepA a;
return a;
-} \ No newline at end of file
+}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index badc76b..af1df22 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -163,6 +163,32 @@ IF(BUILD_TESTING)
IF(CMAKE_Fortran_COMPILER)
ADD_TEST_MACRO(FortranOnly FortranOnly)
ENDIF()
+ # test Visual Studio GNU Fortran mixing with cmake_add_fortran_subdirectory
+ # run this project if we have a working fortran compiler or
+ # the test is enabled with CMAKE_TEST_CMAKE_ADD_FORTRAN cache variable.
+ # If you enable the test, CMake should find the MinGW fortran install,
+ # or in some cases you might need to set the PATH so that cmake can find
+ # the gfortran from mingw.
+ IF(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN)
+ SET(CMAKE_SKIP_VSGNUFortran FALSE)
+ # disable test for apple builds using ifort if they are building
+ # more than one architecture, as ifort does not support that.
+ IF(APPLE AND (CMAKE_Fortran_COMPILER MATCHES ifort))
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES len)
+ IF("${len}" GREATER 1)
+ MESSAGE(STATUS "Skip VSGNUFortran for ifort dual cpu mac build")
+ SET(CMAKE_SKIP_VSGNUFortran TRUE)
+ ENDIF()
+ ENDIF()
+ IF((CMAKE_C_COMPILER MATCHES lsb)
+ AND (CMAKE_Fortran_COMPILER MATCHES ifort))
+ MESSAGE(STATUS "Skip VSGNUFortran for ifort and lsb compilers")
+ SET(CMAKE_SKIP_VSGNUFortran TRUE)
+ ENDIF()
+ IF(NOT CMAKE_SKIP_VSGNUFortran)
+ ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake)
+ ENDIF()
+ ENDIF()
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
ADD_TEST_MACRO(IPO COnly/COnly)
@@ -241,8 +267,6 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader)
- ADD_TEST_MACRO(Module.CheckCXXCompilerFlag CheckCXXCompilerFlag)
-
ADD_TEST(LinkFlags-prepare
${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
--build-and-test
@@ -561,6 +585,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*")
+ find_program(RPMBUILD NAMES rpmbuild)
+ endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*")
+ # Do not try to build RPM
+ if (NOT RPMBUILD)
+ set(CPACK_BINARY_RPM OFF)
+ endif(NOT RPMBUILD)
+
find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
DOC "makensis program location"
@@ -767,56 +799,36 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
- # Como does not seem to support shared libraries.
- GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
- IF(CMAKE_BASE_NAME MATCHES "^como$")
- SET(COMPILER_IS_COMO 1)
- ENDIF(CMAKE_BASE_NAME MATCHES "^como$")
- IF(NOT COMPILER_IS_COMO)
- ADD_TEST(complex ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Complex"
- "${CMake_BINARY_DIR}/Tests/Complex"
- --build-two-config
- --build-config-sample "${CMAKE_CTEST_COMMAND}"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-project Complex
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
- --build-options
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- --test-command complex
- )
- LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex")
+ ADD_TEST(complex ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Complex"
+ "${CMake_BINARY_DIR}/Tests/Complex"
+ --build-two-config
+ --build-config-sample "${CMAKE_CTEST_COMMAND}"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project Complex
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
+ --build-options
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ --test-command complex
+ )
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex")
- ADD_TEST(complexOneConfig ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
- "${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-project Complex
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
- --build-options
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- --test-command complex)
- LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
- # because of the registry write these tests depend on each other
- SET_TESTS_PROPERTIES ( complex PROPERTIES DEPENDS complexOneConfig)
-
-# This fails on VS 70
-# works on Xcode and makefiles
-# ADD_TEST(ConvLibrary ${CMAKE_CTEST_COMMAND}
-# --build-and-test
-# "${CMake_SOURCE_DIR}/Tests/ConvLibrary"
-# "${CMake_BINARY_DIR}/Tests/ConvLibrary"
-# --build-two-config
-# --build-generator ${CMAKE_TEST_GENERATOR}
-# --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
-# --build-project ConvLibrary
-# --test-command bartest)
-
- ENDIF(NOT COMPILER_IS_COMO)
+ ADD_TEST(complexOneConfig ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
+ "${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project Complex
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
+ --build-options
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ --test-command complex)
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
+ # because of the registry write these tests depend on each other
+ SET_TESTS_PROPERTIES ( complex PROPERTIES DEPENDS complexOneConfig)
ADD_TEST(Example ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
new file mode 100644
index 0000000..9257fcc
--- /dev/null
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -0,0 +1,69 @@
+cmake_minimum_required (VERSION 2.8)
+project(AllFindModules)
+
+if (POLICY CMP0017)
+ cmake_policy(SET CMP0017 NEW)
+endif ()
+
+# Avoid ctest truncation of output
+message(STATUS "CTEST_FULL_OUTPUT")
+
+file(GLOB FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/Find*.cmake" )
+
+macro(do_find MODULE_NAME)
+ message(STATUS " Checking Find${MODULE_NAME}")
+ find_package(${MODULE_NAME})
+endmacro(do_find)
+
+# It is only possible to use either Qt3 or Qt4 in one project.
+# Since FindQt will complain if both are found we explicitly request Qt4 here
+# and filter out FindQt3. FindKDE3 also depends on Qt3 and
+# is therefore also blocked
+set(DESIRED_QT_VERSION 4)
+set(NO_QT4_MODULES "Qt3" "KDE3")
+
+# These modules are named Find*.cmake, but are nothing that works in
+# find_package().
+set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage")
+
+foreach(FIND_MODULE ${FIND_MODULES})
+ string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}")
+
+ list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX)
+ list(FIND NO_FIND_MODULES ${MODULE_NAME} NO_FIND_INDEX)
+ if (NO_QT4_INDEX EQUAL -1 AND NO_FIND_INDEX EQUAL -1)
+ do_find(${MODULE_NAME})
+ endif ()
+
+endforeach(FIND_MODULE)
+
+# Qt4 is not present, so we can check Qt3
+if (NOT QT4_FOUND)
+ set(DESIRED_QT_VERSION 3)
+ foreach(FIND_MODULE ${NO_QT4_MODULES} "Qt")
+ do_find(${FIND_MODULE})
+ endforeach(FIND_MODULE)
+endif (NOT QT4_FOUND)
+
+# If any of these modules reported that it was found a version number should have been
+# reported.
+set(VERSIONS_REQUIRED
+ ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX FREETYPE GETTEXT GIF GIT
+ ImageMagick JASPER LibArchive LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL
+ SWIG TIFF ZLIB)
+
+foreach(VTEST ${VERSIONS_REQUIRED})
+ if (${VTEST}_FOUND)
+ if (DEFINED ${VTEST}_VERSION_STRING)
+ if (NOT ${VTEST}_VERSION_STRING MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$")
+ message(SEND_ERROR "${VTEST}_VERSION_STRING has unexpected content ${${VTEST}_VERSION_STRING}")
+ endif()
+ elseif (DEFINED ${VTEST}_VERSION)
+ if (NOT ${VTEST}_VERSION MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$")
+ message(SEND_ERROR "${VTEST}_VERSION has unexpected content ${${VTEST}_VERSION}")
+ endif()
+ else()
+ message(SEND_ERROR "${VTEST}_FOUND is set but no version number is defined")
+ endif()
+ endif(${VTEST}_FOUND)
+endforeach(VTEST)
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index f6aa9b5..4407efb 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -14,3 +14,11 @@ set_property(TEST CMakeOnly.LinkInterfaceLoop PROPERTY TIMEOUT 90)
add_CMakeOnly_test(CheckSymbolExists)
add_CMakeOnly_test(CheckCXXSymbolExists)
+
+add_CMakeOnly_test(CheckCXXCompilerFlag)
+
+add_CMakeOnly_test(CheckLanguage)
+
+add_CMakeOnly_test(AllFindModules)
+
+add_CMakeOnly_test(TargetScope)
diff --git a/Tests/Module/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
index 77f5006..e205330 100644
--- a/Tests/Module/CheckCXXCompilerFlag/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
@@ -56,19 +56,3 @@ if(CMAKE_COMPILER_IS_GNUCXX)
else()
message("Unhandled Platform")
endif()
-
-#
-# This is a no-op executable... If this test is going to fail, it fails during
-# the configure step while cmake is configuring this CMakeLists.txt file...
-#
-
-file(WRITE
- "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
- "int main() { return 0; }
-"
-)
-
-add_executable(
- CheckCXXCompilerFlag
- "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
-)
diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt
new file mode 100644
index 0000000..f5336dc
--- /dev/null
+++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required (VERSION 2.8)
+project(CheckLanguage NONE)
+include(CheckLanguage)
+
+set(langs )
+set(expect_C 1)
+set(expect_CXX 1)
+unset(expect_Fortran)
+set(expect_NoSuchLanguage 0)
+foreach(lang C CXX Fortran NoSuchLanguage)
+ check_language(${lang})
+ if(NOT DEFINED CMAKE_${lang}_COMPILER)
+ message(FATAL_ERROR "check_language(${lang}) did not set result")
+ endif()
+ if(DEFINED expect_${lang})
+ if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER)
+ message(FATAL_ERROR "check_language(${lang}) should not fail!")
+ elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER)
+ message(FATAL_ERROR "check_language(${lang}) should not succeed!")
+ endif()
+ endif()
+endforeach()
diff --git a/Tests/CMakeOnly/TargetScope/CMakeLists.txt b/Tests/CMakeOnly/TargetScope/CMakeLists.txt
new file mode 100644
index 0000000..fa5d8e2
--- /dev/null
+++ b/Tests/CMakeOnly/TargetScope/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required (VERSION 2.8)
+project(TargetScope NONE)
+
+add_subdirectory(Sub)
+
+if(TARGET SubLibLocal)
+ message(FATAL_ERROR "SubLibLocal visible in top directory")
+endif()
+if(NOT TARGET SubLibGlobal)
+ message(FATAL_ERROR "SubLibGlobal not visible in top directory")
+endif()
+
+add_subdirectory(Sib)
diff --git a/Tests/CMakeOnly/TargetScope/Sib/CMakeLists.txt b/Tests/CMakeOnly/TargetScope/Sib/CMakeLists.txt
new file mode 100644
index 0000000..7f6f4e8
--- /dev/null
+++ b/Tests/CMakeOnly/TargetScope/Sib/CMakeLists.txt
@@ -0,0 +1,6 @@
+if(TARGET SubLibLocal)
+ message(FATAL_ERROR "SubLibLocal visible in sibling directory")
+endif()
+if(NOT TARGET SubLibGlobal)
+ message(FATAL_ERROR "SubLibGlobal not visible in sibling directory")
+endif()
diff --git a/Tests/CMakeOnly/TargetScope/Sub/CMakeLists.txt b/Tests/CMakeOnly/TargetScope/Sub/CMakeLists.txt
new file mode 100644
index 0000000..27318f5
--- /dev/null
+++ b/Tests/CMakeOnly/TargetScope/Sub/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_library(SubLibLocal UNKNOWN IMPORTED)
+add_library(SubLibGlobal UNKNOWN IMPORTED GLOBAL)
+add_subdirectory(Sub)
+if(NOT TARGET SubLibLocal)
+ message(FATAL_ERROR "SubLibLocal not visible in own directory")
+endif()
+if(NOT TARGET SubLibGlobal)
+ message(FATAL_ERROR "SubLibGlobal not visible in own directory")
+endif()
diff --git a/Tests/CMakeOnly/TargetScope/Sub/Sub/CMakeLists.txt b/Tests/CMakeOnly/TargetScope/Sub/Sub/CMakeLists.txt
new file mode 100644
index 0000000..a351daa
--- /dev/null
+++ b/Tests/CMakeOnly/TargetScope/Sub/Sub/CMakeLists.txt
@@ -0,0 +1,6 @@
+if(NOT TARGET SubLibLocal)
+ message(FATAL_ERROR "SubLibLocal not visible in subdirectory")
+endif()
+if(NOT TARGET SubLibGlobal)
+ message(FATAL_ERROR "SubLibGlobal not visible in subdirectory")
+endif()
diff --git a/Tests/CMakeTests/If-Invalid-Argument.cmake b/Tests/CMakeTests/If-Invalid-Argument.cmake
new file mode 100644
index 0000000..b4fb97f
--- /dev/null
+++ b/Tests/CMakeTests/If-Invalid-Argument.cmake
@@ -0,0 +1,2 @@
+if (NOT foo bar STREQUAL "foo bar")
+endif()
diff --git a/Tests/CMakeTests/IfTest.cmake.in b/Tests/CMakeTests/IfTest.cmake.in
index e5211b4..639e226 100644
--- a/Tests/CMakeTests/IfTest.cmake.in
+++ b/Tests/CMakeTests/IfTest.cmake.in
@@ -156,3 +156,11 @@ foreach(_bad 2x -2x)
endforeach()
test_vars("")
+
+set(Invalid-Argument-RESULT 1)
+set(Invalid-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*")
+
+include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
+check_cmake_test(If
+ Invalid-Argument
+)
diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt
index 7742055..5ef0f1e 100644
--- a/Tests/COnly/CMakeLists.txt
+++ b/Tests/COnly/CMakeLists.txt
@@ -19,3 +19,5 @@ if("${LANG}" STREQUAL "C")
else("${LANG}" STREQUAL "C")
message(FATAL_ERROR "Bad language for file conly.c")
endif("${LANG}" STREQUAL "C")
+
+add_library(testCModule MODULE testCModule.c)
diff --git a/Tests/COnly/testCModule.c b/Tests/COnly/testCModule.c
new file mode 100644
index 0000000..1a89292
--- /dev/null
+++ b/Tests/COnly/testCModule.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+# define TEST_EXPORT __declspec(dllexport)
+#else
+# define TEST_EXPORT
+#endif
+TEST_EXPORT int testCModule(void) { return 0; }
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index b505019..ec3ad39 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -199,7 +199,9 @@ CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/dummy
${Complex_BINARY_DIR}/Library/dummylib.lib
COPYONLY IMMEDIATE)
-FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl)
+FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl
+ ${CMAKE_SHARED_LIBRARY_SUFFIX}.2
+ ${CMAKE_STATIC_LIBRARY_SUFFIX}.2)
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/dummy
${Complex_BINARY_DIR}/Library/libdummylib${ext}
@@ -216,6 +218,34 @@ FIND_LIBRARY(FIND_DUMMY_LIB
PATHS
${Complex_BINARY_DIR}/Library DOC "find dummy lib")
+# This doesn't work for platforms that have a shared library and an import
+# library, like Windows with .dll and .lib. Limit is to ".so" now because it's
+# known to work there.
+IF(CMAKE_SHARED_LIBRARY_SUFFIX STREQUAL ".so")
+ FIND_LIBRARY(FIND_DUMMY_SHLIB_VERSIONED
+ NAMES libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2
+ PATHS ${Complex_BINARY_DIR}/Library
+ DOC "find versioned dummy shared lib"
+ NO_DEFAULT_PATH)
+
+ IF(NOT FIND_DUMMY_SHLIB_VERSIONED MATCHES "/libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2")
+ MESSAGE(SEND_ERROR "FIND_DUMMY_SHLIB_VERSIONED is not set correctly: "
+ "${FIND_DUMMY_SHLIB_VERSIONED}")
+ ENDIF()
+ENDIF()
+
+# Static library, should work everywhere
+FIND_LIBRARY(FIND_DUMMY_STLIB_VERSIONED
+ NAMES libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2
+ PATHS ${Complex_BINARY_DIR}/Library
+ DOC "find versioned dummy static lib"
+ NO_DEFAULT_PATH)
+
+IF(NOT FIND_DUMMY_STLIB_VERSIONED MATCHES "/libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2")
+ MESSAGE(SEND_ERROR "FIND_DUMMY_STLIB_VERSIONED is not set correctly: "
+ "${FIND_DUMMY_STLIB_VERSIONED}")
+ENDIF()
+
#
# Test SET_SOURCE_FILES_PROPERTIES
#
diff --git a/Tests/Contracts/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos-10-6/Patch.cmake
index a7aae27..76051eb 100644
--- a/Tests/Contracts/Trilinos-10-6/Patch.cmake
+++ b/Tests/Contracts/Trilinos-10-6/Patch.cmake
@@ -2,6 +2,7 @@ if(NOT DEFINED source_dir)
message(FATAL_ERROR "variable 'source_dir' not defined")
endif()
+
if(NOT EXISTS "${source_dir}/CMakeLists.txt")
message(FATAL_ERROR "error: No CMakeLists.txt file to patch!")
endif()
@@ -18,3 +19,20 @@ MESSAGE(\"Trilinos_WARNINGS_AS_ERRORS_FLAGS='\${Trilinos_WARNINGS_AS_ERRORS_FLAG
")
file(APPEND "${source_dir}/CMakeLists.txt" "${text}")
+
+
+if(NOT EXISTS "${source_dir}/CTestConfig.cmake")
+ message(FATAL_ERROR "error: No CTestConfig.cmake file to patch!")
+endif()
+
+set(text "
+
+#
+# Use newer than 10.6.1 CTestConfig settings from the Trilinos project.
+# Send the Trilinos dashboards to the new Trilinos CDash server instance.
+#
+SET(CTEST_NIGHTLY_START_TIME \"04:00:00 UTC\") # 10 PM MDT or 9 PM MST
+SET(CTEST_DROP_SITE \"testing.sandia.gov\")
+")
+
+file(APPEND "${source_dir}/CTestConfig.cmake" "${text}")
diff --git a/Tests/ConvLibrary/CMakeLists.txt b/Tests/ConvLibrary/CMakeLists.txt
deleted file mode 100644
index afc1cb6..0000000
--- a/Tests/ConvLibrary/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-cmake_minimum_required (VERSION 2.6)
-project(ConvLibrary)
-
-# create a source list
-set(foo_sources foo.cxx bar.c sub1/car.cxx)
-# create a library foo from the sources
-add_library(foo ${foo_sources})
-# get the object files from the target
-get_target_property(OBJECT_FILES foo OBJECT_FILES)
-message("${OBJECT_FILES}")
-# set the object files as generated
-set_source_files_properties(${OBJECT_FILES} PROPERTIES GENERATED true)
-# create a library bar that contains the object files from foo
-add_library(bar ${OBJECT_FILES})
-# set the linker language since bar only has .obj
-set_target_properties(bar PROPERTIES LINKER_LANGUAGE CXX)
-# make sure foo is built before bar
-add_dependencies(bar foo)
-add_executable(bartest bartest.cxx)
-target_link_libraries(bartest bar)
diff --git a/Tests/ConvLibrary/bar.c b/Tests/ConvLibrary/bar.c
deleted file mode 100644
index d063082..0000000
--- a/Tests/ConvLibrary/bar.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int bar()
-{
- return 20;
-}
diff --git a/Tests/ConvLibrary/bartest.cxx b/Tests/ConvLibrary/bartest.cxx
deleted file mode 100644
index ab95773..0000000
--- a/Tests/ConvLibrary/bartest.cxx
+++ /dev/null
@@ -1,37 +0,0 @@
-extern "C" int bar();
-int foo();
-int car();
-
-#include <stdio.h>
-int main()
-{
- if(foo() == 10)
- {
- printf("foo is 10!\n");
- }
- else
- {
- printf("foo is not 10 error!\n");
- return -1;
- }
- if(bar() == 20)
- {
- printf("bar is 20!\n");
- }
- else
- {
- printf("bar is not 20 error!\n");
- return -1;
- }
- if(car() == 30)
- {
- printf("car is 30!\n");
- }
- else
- {
- printf("car is not 30 error!\n");
- return -1;
- }
- printf("Test past\n");
- return 0;
-}
diff --git a/Tests/ConvLibrary/foo.cxx b/Tests/ConvLibrary/foo.cxx
deleted file mode 100644
index 1f46ef4..0000000
--- a/Tests/ConvLibrary/foo.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-int foo()
-{
- return 10;
-}
diff --git a/Tests/ConvLibrary/sub1/car.cxx b/Tests/ConvLibrary/sub1/car.cxx
deleted file mode 100644
index aa66726..0000000
--- a/Tests/ConvLibrary/sub1/car.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-int car()
-{
- return 30;
-}
diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt
index 5d27890..e62f3c7 100644
--- a/Tests/CxxOnly/CMakeLists.txt
+++ b/Tests/CxxOnly/CMakeLists.txt
@@ -9,3 +9,5 @@ add_library(testcxx1.my STATIC libcxx1.cxx ${EXTRA_SRCS})
add_library(testcxx2 SHARED libcxx2.cxx)
add_executable (CxxOnly cxxonly.cxx)
target_link_libraries(CxxOnly testcxx1.my testcxx2)
+
+add_library(testCxxModule MODULE testCxxModule.cxx)
diff --git a/Tests/CxxOnly/testCxxModule.cxx b/Tests/CxxOnly/testCxxModule.cxx
new file mode 100644
index 0000000..dd16d2b
--- /dev/null
+++ b/Tests/CxxOnly/testCxxModule.cxx
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+# define TEST_EXPORT __declspec(dllexport)
+#else
+# define TEST_EXPORT
+#endif
+TEST_EXPORT int testCxxModule(void) { return 0; }
diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt
index 953d05c..5cdbc59b 100644
--- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt
+++ b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt
@@ -5,9 +5,6 @@ IF (MUDSLIDE_TYPE MATCHES MUCHO)
ADD_DEFINITIONS(-DMUCHO_MUDSLIDE)
ENDIF (MUDSLIDE_TYPE MATCHES MUCHO)
-IF(WATCOM)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-ENDIF(WATCOM)
INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source)
ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c)
diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt
index e99105a..846cbb0 100644
--- a/Tests/LoadCommand/CMakeLists.txt
+++ b/Tests/LoadCommand/CMakeLists.txt
@@ -12,12 +12,6 @@ INCLUDE (CheckFunctionExists)
CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF)
CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA)
-INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
-CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H)
-
-INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
-CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM)
-
CONFIGURE_FILE(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in
${LoadCommand_BINARY_DIR}/LoadedCommand.h)
diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in
index 7a0a15d..7516a66 100644
--- a/Tests/LoadCommand/LoadedCommand.h.in
+++ b/Tests/LoadCommand/LoadedCommand.h.in
@@ -5,9 +5,3 @@
/* Check for functions */
#cmakedefine HAVE_PRINTF
#cmakedefine HAVE_VSBLABLA
-
-/* Check for headers */
-#cmakedefine HAVE_SYS_PRCTL_H
-
-/* Check for libraries */
-#cmakedefine HAVE_LIBM
diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp
index 445a652..eec46d3 100644
--- a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp
+++ b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp
@@ -6,4 +6,4 @@ int main(int, char**)
SomeClass sc;
sc.someMethod();
return 0;
-} \ No newline at end of file
+}
diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp
index 445a652..eec46d3 100644
--- a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp
+++ b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp
@@ -6,4 +6,4 @@ int main(int, char**)
SomeClass sc;
sc.someMethod();
return 0;
-} \ No newline at end of file
+}
diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp
index 7326b78..427ec29 100644
--- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp
+++ b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp
@@ -4,4 +4,4 @@
void SomeClass::someMethod() const
{
-} \ No newline at end of file
+}
diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp
index d04ae3c..507f6fd 100644
--- a/Tests/Module/GenerateExportHeader/prefix/main.cpp
+++ b/Tests/Module/GenerateExportHeader/prefix/main.cpp
@@ -5,4 +5,4 @@ int main(int argc, char **argv)
{
UsePrefixClass upc;
return upc.someMethod();
-} \ No newline at end of file
+}
diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp
index 8337ab8..1fd2cb2 100644
--- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp
+++ b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp
@@ -4,4 +4,4 @@
int UsePrefixClass::someMethod() const
{
return 0;
-} \ No newline at end of file
+}
diff --git a/Tests/README b/Tests/README
new file mode 100644
index 0000000..9b0f5c1
--- /dev/null
+++ b/Tests/README
@@ -0,0 +1,34 @@
+If you think about adding a new testcase then here is a small checklist you
+can run through to find a proper place for it. Go through the list from the
+beginning and stop once you find something that matches your tests needs,
+i.e. if you will test a module and only need the configure mode use the
+instructions from section 2, not 3.
+
+1. Your testcase can run in CMake script mode, i.e. "cmake -P something"
+
+Put your test in Tests/CMakeTests/ directory as a .cmake.in file. It will be
+put into the test binary directory by configure_file(... @ONLY) and run from
+there. Use the AddCMakeTest() macro in Tests/CMakeTests/CMakeLists.txt to add
+your test to the test runs.
+
+2. Your test needs CMake to run in configure mode, but will not build anything
+
+This includes tests that will build something using try_compile() and friends,
+but nothing that expects add_executable(), add_library(), or add_test() to run.
+
+If this matches your test you should put it into the Tests/CMakeOnly/ directory.
+Create a subdirectory named like your test and write the CMakeLists.txt you
+need into that subdirectory. Use the add_CMakeOnly_test() macro from
+Tests/CMakeOnly/CMakeLists.txt to add your test to the test runs.
+
+3. If you are testing something from the Modules directory
+
+Put your test in the Tests/Modules/ directory. Create a subdirectory there
+named after your test. Use the ADD_TEST_MACRO macro from Tests/CMakeLists.txt
+to add your test to the test run. If you have put your stuff in
+Tests/Modules/Foo then you call it using ADD_TEST_MACRO(Module.Foo Foo).
+
+4. You are doing other stuff.
+
+Find a good place ;) In doubt mail to cmake-developers@cmake.org and ask for
+advise.
diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt
new file mode 100644
index 0000000..229c315
--- /dev/null
+++ b/Tests/VSGNUFortran/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 2.8)
+project(VSGNUFortran)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
+
+# force the executable to be put out of Debug/Release dir
+# because gmake build of fortran will not be in a config
+# directory, and for easier testing we want the exe and .dll
+# to be in the same directory.
+if(CMAKE_CONFIGURATION_TYPES)
+ foreach(config ${CMAKE_CONFIGURATION_TYPES})
+ string(TOUPPER "${config}" config)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config}
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+ endforeach()
+endif()
+
+add_subdirectory(subdir)
+include_directories(${VSGNUFortran_BINARY_DIR}/subdir/fortran)
+add_subdirectory(c_code)
+# use a cmake script to run the executable so that PATH
+# can be set with the MinGW/bin in it, and the fortran
+# runtime libraries can be found.
+configure_file(runtest.cmake.in runtest.cmake @ONLY)
diff --git a/Tests/VSGNUFortran/c_code/CMakeLists.txt b/Tests/VSGNUFortran/c_code/CMakeLists.txt
new file mode 100644
index 0000000..27d22fd
--- /dev/null
+++ b/Tests/VSGNUFortran/c_code/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(c_using_fortran main.c)
+target_link_libraries(c_using_fortran hello)
diff --git a/Tests/VSGNUFortran/c_code/main.c b/Tests/VSGNUFortran/c_code/main.c
new file mode 100644
index 0000000..391bf26
--- /dev/null
+++ b/Tests/VSGNUFortran/c_code/main.c
@@ -0,0 +1,7 @@
+#include <HelloWorldFCMangle.h> // created by FortranCInterface
+extern void FC_hello(void);
+int main()
+{
+ FC_hello();
+ return 0;
+}
diff --git a/Tests/VSGNUFortran/runtest.cmake.in b/Tests/VSGNUFortran/runtest.cmake.in
new file mode 100644
index 0000000..987207b
--- /dev/null
+++ b/Tests/VSGNUFortran/runtest.cmake.in
@@ -0,0 +1,23 @@
+get_filename_component(MINGW_PATH "@MINGW_GFORTRAN@" PATH)
+if(NOT EXISTS "${MINGW_PATH}")
+ set(test_exe
+ "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran@CMAKE_EXECUTABLE_SUFFIX@")
+ message("run: ${test_exe}")
+ execute_process(COMMAND "${test_exe}"
+ RESULT_VARIABLE res)
+ if(NOT "${res}" EQUAL 0)
+ message(FATAL_ERROR "${test_exe} returned a non 0 value")
+ endif()
+ return()
+endif()
+file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH)
+string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
+message("${MINGW_PATH}")
+set(test_exe "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran.exe")
+set(ENV{PATH} "${MINGW_PATH}";$ENV{PATH})
+message("run ${test_exe}")
+execute_process(COMMAND "${test_exe}"
+ RESULT_VARIABLE res)
+if(NOT "${res}" EQUAL 0)
+ message(FATAL_ERROR "${test_exe} returned a non 0 value")
+endif()
diff --git a/Tests/VSGNUFortran/subdir/CMakeLists.txt b/Tests/VSGNUFortran/subdir/CMakeLists.txt
new file mode 100644
index 0000000..0b99199
--- /dev/null
+++ b/Tests/VSGNUFortran/subdir/CMakeLists.txt
@@ -0,0 +1,16 @@
+include(CMakeAddFortranSubdirectory)
+# add the fortran subdirectory as a fortran project
+# the subdir is fortran, the project is FortranHello
+cmake_add_fortran_subdirectory(fortran
+ PROJECT FortranHello # project name in toplevel CMakeLists.txt
+ ARCHIVE_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+ RUNTIME_DIR bin # ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ LIBRARIES hello world # target libraries created
+ CMAKE_COMMAND_LINE
+ -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+ LINK_LIBRARIES # link interface libraries
+ LINK_LIBS hello world # hello needs world to link
+ NO_EXTERNAL_INSTALL
+ )
diff --git a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt
new file mode 100644
index 0000000..3ee1855
--- /dev/null
+++ b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt
@@ -0,0 +1,46 @@
+cmake_minimum_required(VERSION 2.8)
+project(FortranHello Fortran C)
+
+# add a function to test for -lsunquad on sunpro sun systems.
+function(test_sunquad result)
+ set( TEST_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/sunq")
+ file(WRITE "${TEST_DIR}/testsunq.f" "
+ PROGRAM TEST
+ END
+ ")
+ file(WRITE ${TEST_DIR}/CMakeLists.txt "
+project(sunq Fortran)
+add_library(sunq SHARED testsunq.f)
+target_link_libraries(sunq sunquad)
+")
+ message(STATUS "looking for -lsunquad")
+ try_compile(RESULT "${TEST_DIR}" "${TEST_DIR}" sunq OUTPUT_VARIABLE OUT)
+ if("${RESULT}")
+ message(STATUS "-lsunquad found")
+ else()
+ message(STATUS "-lsunquad not found")
+ endif()
+ message(STATUS
+ "looking for sunquad:\nRESULT=[${RESULT}]\nOUTPUT=[\n${OUT}\n]")
+ set(${result} "${RESULT}" PARENT_SCOPE)
+endfunction()
+
+# check for the fortran c interface mangling
+include(FortranCInterface)
+FortranCInterface_HEADER(HelloWorldFCMangle.h
+ MACRO_NAMESPACE "FC_"
+ SYMBOL_NAMESPACE "FC_"
+ SYMBOLS hello world)
+add_library(hello SHARED hello.f)
+add_library(world SHARED world.f)
+target_link_libraries(hello world)
+if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro)
+ target_link_libraries(hello fsu)
+ if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS)
+ target_link_libraries(hello sunmath m)
+ test_sunquad(CMAKE_HAS_SUNQUAD)
+ if(CMAKE_HAS_SUNQUAD)
+ target_link_libraries(hello sunquad)
+ endif()
+ endif()
+endif()
diff --git a/Tests/VSGNUFortran/subdir/fortran/hello.f b/Tests/VSGNUFortran/subdir/fortran/hello.f
new file mode 100644
index 0000000..e52119a
--- /dev/null
+++ b/Tests/VSGNUFortran/subdir/fortran/hello.f
@@ -0,0 +1,7 @@
+!DEC$ ATTRIBUTES DLLEXPORT :: HELLO
+ SUBROUTINE HELLO
+
+ PRINT *, 'Hello'
+ CALL WORLD
+
+ END
diff --git a/Tests/VSGNUFortran/subdir/fortran/world.f b/Tests/VSGNUFortran/subdir/fortran/world.f
new file mode 100644
index 0000000..0598eee
--- /dev/null
+++ b/Tests/VSGNUFortran/subdir/fortran/world.f
@@ -0,0 +1,6 @@
+!DEC$ ATTRIBUTES DLLEXPORT :: WORLD
+ SUBROUTINE WORLD
+
+ PRINT *, 'World!'
+
+ END
diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in
index e95a4ff..e85a1c5 100644
--- a/Utilities/KWIML/ABI.h.in
+++ b/Utilities/KWIML/ABI.h.in
@@ -380,7 +380,15 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined.
#elif defined(__m68k__) || defined(M68000)
# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
-/* MIPS */
+/* MIPSel (MIPS little endian) */
+#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+
+/* MIPSeb (MIPS big endian) */
+#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* MIPS (fallback, big endian) */
#elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake
index 115181d..3e6b049 100644
--- a/Utilities/Release/dashmacmini2_release.cmake
+++ b/Utilities/Release/dashmacmini2_release.cmake
@@ -5,14 +5,14 @@ set(INSTALL_PREFIX /)
set(HOST dashmacmini2)
set(MAKE_PROGRAM "make")
set(MAKE "${MAKE_PROGRAM} -j2")
-set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ")
+set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ")
set(INITIAL_CACHE "
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CPACK_SYSTEM_NAME:STRING=Darwin-universal
BUILD_QtDialog:BOOL=TRUE
-QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Software/QtBinUniversal/bin/qmake
+QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake
")
get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${path}/release_cmake.cmake)
diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake
index 9bb3a98..bd93a87 100644
--- a/Utilities/Release/dashmacmini5_release.cmake
+++ b/Utilities/Release/dashmacmini5_release.cmake
@@ -14,7 +14,7 @@ CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CPACK_SYSTEM_NAME:STRING=Darwin64-universal
BUILD_QtDialog:BOOL=TRUE
-QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.7.4/install/bin/qmake
+QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake
")
get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${path}/release_cmake.cmake)
diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake
index 549460e..1b2ae02 100644
--- a/Utilities/Release/magrathea_release.cmake
+++ b/Utilities/Release/magrathea_release.cmake
@@ -10,7 +10,7 @@ CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses
FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a
CPACK_SYSTEM_NAME:STRING=Linux-i386
BUILD_QtDialog:BOOL:=TRUE
-QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-x11-opensource-src-4.3.3-install/bin/qmake
+QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.43-install/bin/qmake
")
get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${path}/release_cmake.cmake)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index ef300bd..29ce25d6 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -185,6 +185,11 @@ IF(CMAKE_USE_OPENSSL)
CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL)
ENDIF(WIN32)
+ SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
+ MARK_AS_ADVANCED(CURL_CA_BUNDLE)
+ IF(CURL_CA_BUNDLE)
+ ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}")
+ ENDIF(CURL_CA_BUNDLE)
ENDIF(CMAKE_USE_OPENSSL)
# Check for idn
diff --git a/Utilities/cmlibarchive/libarchive/archive_platform.h b/Utilities/cmlibarchive/libarchive/archive_platform.h
index ce2f482..cdd9c7c 100644
--- a/Utilities/cmlibarchive/libarchive/archive_platform.h
+++ b/Utilities/cmlibarchive/libarchive/archive_platform.h
@@ -76,6 +76,11 @@
#define __FBSDID(a) struct _undefined_hack
#endif
+/* Old glibc mbsnrtowcs fails assertions in our use case. */
+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 1
+# undef HAVE_MBSNRTOWCS
+#endif
+
/* Try to get standard C99-style integer type definitions. */
#if HAVE_INTTYPES_H
#include <inttypes.h>