summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCCompilerId.c.in3
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in3
-rw-r--r--Modules/Compiler/Clang-C.cmake1
-rw-r--r--Modules/Compiler/Clang-CXX.cmake1
-rw-r--r--Modules/DartConfiguration.tcl.in1
-rw-r--r--Modules/ExternalProject.cmake284
-rw-r--r--Modules/FindGit.cmake46
-rw-r--r--Modules/FindQt4.cmake28
-rw-r--r--Modules/FindThreads.cmake6
-rw-r--r--Modules/FindZLIB.cmake2
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake1
-rw-r--r--Modules/Platform/Linux-Clang-C.cmake1
-rw-r--r--Modules/Platform/Linux-Clang-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-SunPro-CXX.cmake9
-rw-r--r--Modules/Platform/OSF1.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-Fortran.cmake1
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Modules/Platform/Windows-wcl386.cmake6
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake7
19 files changed, 334 insertions, 70 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 5d004c7..accda32 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -9,6 +9,9 @@
#if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
+#elif defined(__clang__)
+# define COMPILER_ID "Clang"
+
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 00ab8e2..4a32823 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -11,6 +11,9 @@
#elif defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
+#elif defined(__clang__)
+# define COMPILER_ID "Clang"
+
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
new file mode 100644
index 0000000..f7baf68
--- /dev/null
+++ b/Modules/Compiler/Clang-C.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-C)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
new file mode 100644
index 0000000..d3c403a
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-CXX)
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 85b4138..51f514f 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -49,6 +49,7 @@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@
# Git options
GITCommand: @GITCOMMAND@
GITUpdateOptions: @GIT_UPDATE_OPTIONS@
+GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@
# Generic update command
UpdateCommand: @UPDATE_COMMAND@
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0302d5c..d0845e6 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -16,7 +16,12 @@
# [CVS_TAG tag] # Tag to checkout from CVS repo
# [SVN_REPOSITORY url] # URL of Subversion repo
# [SVN_REVISION rev] # Revision to checkout from Subversion repo
+# [SVN_USERNAME john ] # Username for Subversion checkout and update
+# [SVN_PASSWORD doe ] # Password for Subversion checkout and update
+# [GIT_REPOSITORY url] # URL of git repo
+# [GIT_TAG tag] # Git branch name, commit id or tag
# [URL /.../src.tgz] # Full path or URL of source
+# [URL_MD5 md5] # MD5 checksum of file at URL
# [TIMEOUT seconds] # Time allowed for file download operations
# #--Update/Patch step----------
# [UPDATE_COMMAND cmd...] # Source work-tree update command
@@ -111,19 +116,19 @@
# License text for the above reference.)
# Pre-compute a regex to match documented keywords for each command.
-file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 100
- REGEX "^# ( \\[[A-Z_]+ [^]]*\\] +#.*$|[A-Za-z_]+\\()")
+file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 103
+ REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
foreach(line IN LISTS lines)
- if("${line}" MATCHES "^# [A-Za-z_]+\\(")
+ if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
if(_ep_func)
set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
endif()
- string(REGEX REPLACE "^# ([A-Za-z_]+)\\(.*" "\\1" _ep_func "${line}")
+ string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}")
#message("function [${_ep_func}]")
set(_ep_keywords_${_ep_func} "^(")
set(_ep_keyword_sep)
else()
- string(REGEX REPLACE "^# \\[([A-Z_]+) .*" "\\1" _ep_key "${line}")
+ string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}")
#message(" keyword [${_ep_key}]")
set(_ep_keywords_${_ep_func}
"${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}")
@@ -148,7 +153,7 @@ function(_ep_parse_arguments f name ns args)
foreach(arg IN LISTS args)
set(is_value 1)
- if(arg MATCHES "^[A-Z][A-Z_][A-Z_]+$" AND
+ if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND
NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND
NOT arg MATCHES "^(TRUE|FALSE)$")
if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}")
@@ -157,6 +162,7 @@ function(_ep_parse_arguments f name ns args)
if(NOT (key STREQUAL "COMMAND")
AND NOT (key STREQUAL "CVS_MODULE")
AND NOT (key STREQUAL "DEPENDS")
+ AND NOT (key STREQUAL "DOWNLOAD_COMMAND")
)
message(AUTHOR_WARNING "unknown ${f} keyword: ${arg}")
endif()
@@ -203,7 +209,63 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED
)
-function(_ep_write_downloadfile_script script_filename remote local timeout)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir)
+ file(WRITE ${script_filename}
+"if(\"${git_tag}\" STREQUAL \"\")
+ message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
+endif()
+
+execute_process(
+ COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\"
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" submodule init
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to init submodules in: '${work_dir}/${src_name}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\")
+endif()
+
+"
+)
+
+endfunction(_ep_write_gitclone_script)
+
+
+function(_ep_write_downloadfile_script script_filename remote local timeout md5)
if(timeout)
set(timeout_args TIMEOUT ${timeout})
set(timeout_msg "${timeout} seconds")
@@ -212,6 +274,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout)
set(timeout_msg "none")
endif()
+ if(md5)
+ set(md5_args EXPECTED_MD5 ${md5})
+ else()
+ set(md5_args "# no EXPECTED_MD5")
+ endif()
+
file(WRITE ${script_filename}
"message(STATUS \"downloading...
src='${remote}'
@@ -221,6 +289,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout)
file(DOWNLOAD
\"${remote}\"
\"${local}\"
+ SHOW_PROGRESS
+ ${md5_args}
${timeout_args}
STATUS status
LOG log)
@@ -243,23 +313,64 @@ message(STATUS \"downloading... done\")
endfunction(_ep_write_downloadfile_script)
-function(_ep_write_extractfile_script script_filename filename tmp directory)
- set(args "")
+function(_ep_write_verifyfile_script script_filename local md5)
+ file(WRITE ${script_filename}
+"message(STATUS \"verifying file...
+ file='${local}'\")
- if(filename MATCHES ".tar$")
- set(args xf)
+set(verified 0)
+
+# If an expected md5 checksum exists, compare against it:
+#
+if(NOT \"${md5}\" STREQUAL \"\")
+ execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\"
+ OUTPUT_VARIABLE ov
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE rv)
+
+ if(NOT rv EQUAL 0)
+ message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\")
endif()
- if(filename MATCHES ".tgz$")
- set(args xfz)
+ string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\")
+
+ string(TOLOWER \"\${md5_actual}\" md5_actual)
+ string(TOLOWER \"${md5}\" md5)
+
+ if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\")
+ message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value
+ md5_expected: \${md5}
+ md5_actual: \${md5_actual}
+\")
endif()
- if(filename MATCHES ".tar.gz$")
+ set(verified 1)
+endif()
+
+if(verified)
+ message(STATUS \"verifying file... done\")
+else()
+ message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\")
+endif()
+"
+)
+
+endfunction(_ep_write_verifyfile_script)
+
+
+function(_ep_write_extractfile_script script_filename filename directory)
+ set(args "")
+
+ if(filename MATCHES "(\\.bz2|\\.tar\\.gz|\\.tgz|\\.zip)$")
set(args xfz)
endif()
+ if(filename MATCHES "\\.tar$")
+ set(args xf)
+ endif()
+
if(args STREQUAL "")
- message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tgz and .tar.gz")
+ message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip")
return()
endif()
@@ -267,20 +378,23 @@ function(_ep_write_extractfile_script script_filename filename tmp directory)
"# Make file names absolute:
#
get_filename_component(filename \"${filename}\" ABSOLUTE)
-get_filename_component(tmp \"${tmp}\" ABSOLUTE)
get_filename_component(directory \"${directory}\" ABSOLUTE)
message(STATUS \"extracting...
src='\${filename}'
dst='\${directory}'\")
+if(NOT EXISTS \"\${filename}\")
+ message(FATAL_ERROR \"error: file to extract does not exist: '\${filename}'\")
+endif()
+
# Prepare a space for extracting:
#
-set(i 1)
-while(EXISTS \"\${tmp}/extract\${i}\")
+set(i 1234)
+while(EXISTS \"\${directory}/../ex\${i}\")
math(EXPR i \"\${i} + 1\")
endwhile()
-set(ut_dir \"\${tmp}/extract\${i}\")
+set(ut_dir \"\${directory}/../ex\${i}\")
file(MAKE_DIRECTORY \"\${ut_dir}\")
# Extract it:
@@ -305,10 +419,12 @@ if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
set(contents \"\${ut_dir}\")
endif()
-# Copy \"the one\" directory to the final directory:
+# Move \"the one\" directory to the final directory:
#
-message(STATUS \"extracting... [copy]\")
-file(COPY \"\${contents}/\" DESTINATION \${directory})
+message(STATUS \"extracting... [rename]\")
+file(REMOVE_RECURSE \${directory})
+get_filename_component(contents \${contents} ABSOLUTE)
+file(RENAME \${contents} \${directory})
# Clean up:
#
@@ -609,6 +725,29 @@ function(_ep_add_mkdir_command name)
endfunction(_ep_add_mkdir_command)
+function(_ep_get_git_version git_EXECUTABLE git_version_var)
+ if(git_EXECUTABLE)
+ execute_process(
+ COMMAND "${git_EXECUTABLE}" --version
+ OUTPUT_VARIABLE ov
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}")
+ set(${git_version_var} "${version}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+function(_ep_is_dir_empty dir empty_var)
+ file(GLOB gr "${dir}/*")
+ if("${gr}" STREQUAL "")
+ set(${empty_var} 1 PARENT_SCOPE)
+ else()
+ set(${empty_var} 0 PARENT_SCOPE)
+ endif()
+endfunction()
+
+
function(_ep_add_download_command name)
ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir)
@@ -616,6 +755,7 @@ function(_ep_add_download_command name)
get_property(cmd TARGET ${name} PROPERTY _EP_DOWNLOAD_COMMAND)
get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY)
get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
+ get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
get_property(url TARGET ${name} PROPERTY _EP_URL)
# TODO: Perhaps file:// should be copied to download dir before extraction.
@@ -661,8 +801,10 @@ function(_ep_add_download_command name)
endif()
get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION)
+ get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME)
+ get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD)
- set(repository ${svn_repository})
+ set(repository "${svn_repository} user=${svn_username} password=${svn_password}")
set(module)
set(tag ${svn_revision})
configure_file(
@@ -674,13 +816,55 @@ function(_ep_add_download_command name)
get_filename_component(src_name "${source_dir}" NAME)
get_filename_component(work_dir "${source_dir}" PATH)
set(comment "Performing download step (SVN checkout) for '${name}'")
- set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} ${src_name})
+ set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision}
+ --username=${svn_username} --password=${svn_password} ${src_name})
list(APPEND depends ${stamp_dir}/${name}-svninfo.txt)
+ elseif(git_repository)
+ find_package(Git)
+ if(NOT GIT_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find git for clone of ${name}")
+ endif()
+
+ # The git submodule update '--recursive' flag requires git >= v1.6.5
+ #
+ _ep_get_git_version("${GIT_EXECUTABLE}" git_version)
+ if(git_version VERSION_LESS 1.6.5)
+ message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'")
+ endif()
+
+ get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
+ if(NOT git_tag)
+ set(git_tag "master")
+ endif()
+
+ set(repository ${git_repository})
+ set(module)
+ set(tag ${git_tag})
+ configure_file(
+ "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${stamp_dir}/${name}-gitinfo.txt"
+ @ONLY
+ )
+
+ get_filename_component(src_name "${source_dir}" NAME)
+ get_filename_component(work_dir "${source_dir}" PATH)
+
+ # Since git clone doesn't succeed if the non-empty source_dir exists,
+ # create a cmake script to invoke as download command.
+ # The script will delete the source directory and then call git clone.
+ #
+ _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
+ ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${src_name} ${work_dir}
+ )
+ set(comment "Performing download step (git clone) for '${name}'")
+ set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake)
+ list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt)
elseif(url)
get_filename_component(work_dir "${source_dir}" PATH)
+ get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5)
set(repository "external project URL")
set(module "${url}")
- set(tag "")
+ set(tag "${md5}")
configure_file(
"${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-urlinfo.txt"
@@ -696,25 +880,30 @@ function(_ep_add_download_command name)
if("${url}" MATCHES "^[a-z]+://")
# TODO: Should download and extraction be different steps?
string(REGEX MATCH "[^/]*$" fname "${url}")
- if(NOT "${fname}" MATCHES "\\.(tar|tgz|tar\\.gz)$")
+ if(NOT "${fname}" MATCHES "\\.(bz2|tar|tgz|tar\\.gz|zip)$")
message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}")
endif()
set(file ${download_dir}/${fname})
get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
- _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}")
+ _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}")
set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake
COMMAND)
- set(comment "Performing download step (download and extract) for '${name}'")
+ set(comment "Performing download step (download, verify and extract) for '${name}'")
else()
set(file "${url}")
- set(comment "Performing download step (extract) for '${name}'")
+ set(comment "Performing download step (verify and extract) for '${name}'")
endif()
+ _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}")
+ list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake)
# TODO: Support other archive formats.
- _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${tmp_dir}" "${source_dir}")
+ _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${source_dir}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
endif()
else()
- message(SEND_ERROR "error: no download info for '${name}' -- please specify existing SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY or DOWNLOAD_COMMAND")
+ _ep_is_dir_empty("${source_dir}" empty)
+ if(${empty})
+ message(SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY or DOWNLOAD_COMMAND")
+ endif()
endif()
ExternalProject_Add_Step(${name} download
@@ -734,6 +923,7 @@ function(_ep_add_update_command name)
get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND)
get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY)
get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
+ get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
set(work_dir)
set(comment)
@@ -757,7 +947,25 @@ function(_ep_add_update_command name)
set(work_dir ${source_dir})
set(comment "Performing update step (SVN update) for '${name}'")
get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION)
- set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision})
+ get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME)
+ get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD)
+ set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision}
+ --username=${svn_username} --password=${svn_password})
+ set(always 1)
+ elseif(git_repository)
+ if(NOT GIT_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find git for fetch of ${name}")
+ endif()
+ set(work_dir ${source_dir})
+ set(comment "Performing update step (git fetch) for '${name}'")
+ get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
+ if(NOT git_tag)
+ set(git_tag "master")
+ endif()
+ set(cmd ${GIT_EXECUTABLE} fetch
+ COMMAND ${GIT_EXECUTABLE} checkout ${git_tag}
+ COMMAND ${GIT_EXECUTABLE} submodule update --recursive
+ )
set(always 1)
endif()
@@ -793,7 +1001,7 @@ endfunction(_ep_add_patch_command)
# TODO: Make sure external projects use the proper compiler
function(_ep_add_configure_command name)
- ExternalProject_Get_Property(${name} source_dir binary_dir)
+ ExternalProject_Get_Property(${name} source_dir binary_dir tmp_dir)
_ep_get_configuration_subdir_suffix(cfgdir)
@@ -827,6 +1035,16 @@ function(_ep_add_configure_command name)
endif()
endif()
+ # If anything about the configure command changes, (command itself, cmake
+ # used, cmake args or cmake generator) then re-run the configure step.
+ # Fixes issue http://public.kitware.com/Bug/view.php?id=10258
+ #
+ if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in)
+ file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n")
+ endif()
+ configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt)
+ list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt)
+
ExternalProject_Add_Step(${name} configure
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
new file mode 100644
index 0000000..2d82142
--- /dev/null
+++ b/Modules/FindGit.cmake
@@ -0,0 +1,46 @@
+# The module defines the following variables:
+# GIT_EXECUTABLE - path to git command line client
+# GIT_FOUND - true if the command line client was found
+# Example usage:
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
+
+#=============================================================================
+# Copyright 2010 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 distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
+
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
+endif()
+
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index f2de4c9..654879e 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -360,34 +360,6 @@ SET( QT_DEFINITIONS "")
SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
-# macro for asking qmake to process pro files
-MACRO(QT_QUERY_QMAKE outvar invar)
- IF(QT_QMAKE_EXECUTABLE)
- FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro
- "message(CMAKE_MESSAGE<$$${invar}>)")
-
- # Invoke qmake with the tmp.pro program to get the desired
- # information. Use the same variable for both stdout and stderr
- # to make sure we get the output on all platforms.
- EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake
- OUTPUT_VARIABLE _qmake_query_output
- RESULT_VARIABLE _qmake_result
- ERROR_VARIABLE _qmake_query_output )
-
- FILE(REMOVE_RECURSE
- "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")
-
- IF(_qmake_result)
- MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}")
- ELSE(_qmake_result)
- STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}")
- ENDIF(_qmake_result)
-
- ENDIF(QT_QMAKE_EXECUTABLE)
-ENDMACRO(QT_QUERY_QMAKE)
-
GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
# check for qmake
# Debian uses qmake-qt4
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 459129b..2a74304 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -5,6 +5,8 @@
# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
# CMAKE_USE_PTHREADS_INIT - are we using pthreads
# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
+# For systems with multiple thread libraries, caller can set
+# CMAKE_THREAD_PREFER_PTHREADS
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -24,11 +26,11 @@ INCLUDE (CheckLibraryExists)
SET(Threads_FOUND FALSE)
# Do we have sproc?
-IF(CMAKE_SYSTEM MATCHES IRIX)
+IF(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
ENDIF()
-IF(CMAKE_HAVE_SPROC_H)
+IF(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
# We have sproc
SET(CMAKE_USE_SPROC_INIT 1)
ELSE()
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 499ae77..b437e6b 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -36,7 +36,7 @@ FIND_LIBRARY(ZLIB_LIBRARY
)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-IF (ZLIB_INCLUDE_DIR)
+IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H)
STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}")
ENDIF()
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index 6a80f62..24bb92a 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -45,6 +45,7 @@ macro(__cygwin_compiler_gnu lang)
SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
ENDFOREACH(type)
+ set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols")
# TODO: Is -Wl,--enable-auto-import now always default?
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}")
diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake
new file mode 100644
index 0000000..dbf8956
--- /dev/null
+++ b/Modules/Platform/Linux-Clang-C.cmake
@@ -0,0 +1 @@
+INCLUDE(Platform/Linux-GNU-C)
diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake
new file mode 100644
index 0000000..8fe251c
--- /dev/null
+++ b/Modules/Platform/Linux-Clang-CXX.cmake
@@ -0,0 +1 @@
+INCLUDE(Platform/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake
index 5490473..8ee9658 100644
--- a/Modules/Platform/Linux-SunPro-CXX.cmake
+++ b/Modules/Platform/Linux-SunPro-CXX.cmake
@@ -1,2 +1,9 @@
-SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ")
+# Sun C++ 5.9 does not support -Wl, but Sun C++ 5.11 does not work without it.
+# Query the compiler flags to detect whether to use -Wl.
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -flags OUTPUT_VARIABLE _cxx_flags ERROR_VARIABLE _cxx_error)
+if("${_cxx_flags}" MATCHES "\n-W[^\n]*component")
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-Wl,-rpath-link,")
+else()
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ")
+endif()
SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic")
diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake
index 652bed4..076410a 100644
--- a/Modules/Platform/OSF1.cmake
+++ b/Modules/Platform/OSF1.cmake
@@ -25,6 +25,7 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/...
IF(CMAKE_COMPILER_IS_GNUCXX)
# include the gcc flags
diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake
index c66feed..8273a19 100644
--- a/Modules/Platform/Windows-GNU-Fortran.cmake
+++ b/Modules/Platform/Windows-GNU-Fortran.cmake
@@ -1,2 +1,3 @@
include(Platform/Windows-GNU)
__windows_compiler_gnu(Fortran)
+set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0)
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 6d84940..af03841 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -68,6 +68,8 @@ macro(__windows_compiler_gnu lang)
endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows
+ set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@")
# Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake
index b260489..7fc345f 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -31,7 +31,7 @@ SET(CMAKE_C_CREATE_IMPORT_LIBRARY
SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
SET(CMAKE_C_LINK_EXECUTABLE
- "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
@@ -52,7 +52,7 @@ SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_CREATE_SHARED_MODULE
- "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
${CMAKE_CXX_CREATE_SHARED_MODULE}
${CMAKE_CXX_CREATE_IMPORT_LIBRARY})
@@ -64,7 +64,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE})
# create a C++ static library
-SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <OBJECTS> ")
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ")
# create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index ccbc828..1d77c7a 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -301,8 +301,11 @@ IF(Q_WS_X11)
# X11 libraries Qt always depends on
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB})
- QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD")
- SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD})
+ set(CMAKE_THREAD_PREFER_PTHREADS 1)
+ find_package(Threads)
+ if(CMAKE_USE_PTHREADS_INIT)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})
+ endif(CMAKE_USE_PTHREADS_INIT)
SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS})