diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCheckCompilerFlagCommonPatterns.cmake | 41 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 3 | ||||
-rw-r--r-- | Modules/CMakeFindEclipseCDT4.cmake | 46 | ||||
-rw-r--r-- | Modules/CMakeGraphVizOptions.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakePackageConfigHelpers.cmake | 39 | ||||
-rw-r--r-- | Modules/CheckCCompilerFlag.cmake | 16 | ||||
-rw-r--r-- | Modules/CheckCXXCompilerFlag.cmake | 19 | ||||
-rw-r--r-- | Modules/CheckStructHasMember.cmake | 35 | ||||
-rw-r--r-- | Modules/FindGTK2.cmake | 5 | ||||
-rw-r--r-- | Modules/FindLua.cmake | 153 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPythonInterp.cmake | 18 | ||||
-rw-r--r-- | Modules/FindPythonLibs.cmake | 10 | ||||
-rw-r--r-- | Modules/FindwxWidgets.cmake | 2 | ||||
-rw-r--r-- | Modules/FortranCInterface/Detect.cmake | 2 | ||||
-rw-r--r-- | Modules/GenerateExportHeader.cmake | 47 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 16 | ||||
-rw-r--r-- | Modules/exportheader.cmake.in | 10 |
18 files changed, 375 insertions, 91 deletions
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake new file mode 100644 index 0000000..9d8ba9e --- /dev/null +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -0,0 +1,41 @@ + +#============================================================================= +# Copyright 2006-2011 Kitware, Inc. +# Copyright 2006 Alexander Neundorf <neundorf@kde.org> +# Copyright 2011 Matthias Kretz <kretz@kde.org> +# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de> +# +# 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.) + +# Do NOT include this module directly into any of your code. It is meant as +# a library for Check*CompilerFlag.cmake modules. It's content may change in +# any way between releases. + +macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) + set(${_VAR} + FAIL_REGEX "unrecognized .*option" # GNU + FAIL_REGEX "unknown .*option" # Clang + FAIL_REGEX "ignoring unknown option" # MSVC + FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "option.*not supported" # Intel + FAIL_REGEX "invalid argument .*option" # Intel + FAIL_REGEX "ignoring option .*argument required" # Intel + FAIL_REGEX "[Uu]nknown option" # HP + FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro + FAIL_REGEX "command option .* is not recognized" # XL + FAIL_REGEX "command option .* contains an incorrect subargument" # 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 + FAIL_REGEX "Incorrect command line option:" # Borland + FAIL_REGEX "Warning: illegal option" # SunStudio 12 + ) +endmacro () diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 8ca5334..da955cb 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -161,7 +161,8 @@ Id flags: ${testflags} ) # Match the compiler location line printed out. if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]") - set(_comp "${CMAKE_MATCH_1}") + # Strip VS diagnostic output from the end of the line. + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}") if(EXISTS "${_comp}") file(TO_CMAKE_PATH "${_comp}" _comp) set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index ae17454..b67e0f0 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -19,18 +19,6 @@ find_program(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable" function(_FIND_ECLIPSE_VERSION) # This code is in a function so the variables used here have only local scope - if(CMAKE_ECLIPSE_EXECUTABLE) - # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036) - get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH) - get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH) - file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*") - if(APPLE AND NOT _ECLIPSE_FEATURE_DIR) - file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*") - endif() - if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+") - set(_ECLIPSE_VERSION ${CMAKE_MATCH_1}) - endif() - endif() # Set up a map with the names of the Eclipse releases: set(_ECLIPSE_VERSION_NAME_ "Unknown" ) @@ -41,15 +29,34 @@ function(_FIND_ECLIPSE_VERSION) set(_ECLIPSE_VERSION_NAME_3.6 "Helios" ) set(_ECLIPSE_VERSION_NAME_3.7 "Indigo" ) set(_ECLIPSE_VERSION_NAME_4.2 "Juno" ) + set(_ECLIPSE_VERSION_NAME_4.3 "Kepler" ) + + if(NOT DEFINED CMAKE_ECLIPSE_VERSION) + if(CMAKE_ECLIPSE_EXECUTABLE) + # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036) + get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH) + get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH) + file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*") + if(APPLE AND NOT _ECLIPSE_FEATURE_DIR) + file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*") + endif() + if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+") + set(_ECLIPSE_VERSION ${CMAKE_MATCH_1}) + endif() + endif() + + if(_ECLIPSE_VERSION) + message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})") + else() + set(_ECLIPSE_VERSION "3.6" ) + message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") + endif() - if(_ECLIPSE_VERSION) - message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})") + set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.") else() - set(_ECLIPSE_VERSION "3.6" ) - message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") + message(STATUS "Eclipse version is set to ${CMAKE_ECLIPSE_VERSION}. Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") endif() - set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.") set_property(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})" "3.3 (${_ECLIPSE_VERSION_NAME_3.3})" "3.4 (${_ECLIPSE_VERSION_NAME_3.4})" @@ -57,16 +64,17 @@ function(_FIND_ECLIPSE_VERSION) "3.6 (${_ECLIPSE_VERSION_NAME_3.6})" "3.7 (${_ECLIPSE_VERSION_NAME_3.7})" "4.2 (${_ECLIPSE_VERSION_NAME_4.2})" + "4.3 (${_ECLIPSE_VERSION_NAME_4.3})" ) endfunction() -_FIND_ECLIPSE_VERSION() +_find_eclipse_version() # Try to find out how many CPUs we have and set the -j argument for make accordingly set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "") include(ProcessorCount) -PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT) +processorcount(_CMAKE_ECLIPSE_PROCESSOR_COUNT) # Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name # (we may also get here in the future e.g. for ninja) diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake index e4af54c..2f04abb 100644 --- a/Modules/CMakeGraphVizOptions.cmake +++ b/Modules/CMakeGraphVizOptions.cmake @@ -53,7 +53,7 @@ # Default : TRUE ##end ##variable -# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude static libraries from the generated graphs. +# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude module libraries from the generated graphs. # Mandatory : NO # Default : TRUE ##end diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index d042d5e..3c56b7f 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -3,7 +3,8 @@ # CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path> # [PATH_VARS <var1> <var2> ... <varN>] # [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [NO_FIND_DEPENDENCY_MACRO]) # # CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain # configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake @@ -154,7 +155,7 @@ endmacro() function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) set(oneValueArgs INSTALL_DESTINATION ) set(multiValueArgs PATH_VARS ) @@ -240,6 +241,40 @@ endmacro() ") endif() + if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(find_dependency dep) + if (NOT \${dep}_FOUND) + if (\${ARGV1}) + set(version \${ARGV1}) + endif() + set(exact_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) + set(exact_arg EXACT) + endif() + set(quiet_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(quiet_arg QUIET) + endif() + set(required_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(required_arg REQUIRED) + endif() + + find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) + if (NOT \${dep}_FOUND) + set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") + set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + set(required_arg) + set(quiet_arg) + set(exact_arg) + endif() +endmacro() +") + endif() + set(PACKAGE_INIT "${PACKAGE_INIT} ####################################################################################") diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index bc15e9a..dab5710 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -26,36 +26,30 @@ # License text for the above reference.) include(CheckCSourceCompiles) +include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + # Normalize locale during test compilation. set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}") set(ENV{${v}} C) endforeach() + CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS) CHECK_C_SOURCE_COMPILES("int main(void) { 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 - FAIL_REGEX "warning D9002" # MSVC, any lang - FAIL_REGEX "option.*not supported" # Intel - FAIL_REGEX "invalid argument .*option" # Intel - FAIL_REGEX "ignoring option .*argument required" # Intel - 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 + ${_CheckCCompilerFlag_COMMON_PATTERNS} ) foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) unset(_CheckCCompilerFlag_SAVED_${v}) endforeach() unset(_CheckCCompilerFlag_LOCALE_VARS) + unset(_CheckCCompilerFlag_COMMON_PATTERNS) set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index eee3a70..4435a1f 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -26,6 +26,7 @@ # License text for the above reference.) include(CheckCXXSourceCompiles) +include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") @@ -37,28 +38,18 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}") set(ENV{${v}} C) endforeach() - CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} + CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS) + 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 - FAIL_REGEX "warning D9002" # MSVC, any lang - FAIL_REGEX "option.*not supported" # Intel - FAIL_REGEX "invalid argument .*option" # Intel - FAIL_REGEX "ignoring option .*argument required" # Intel - FAIL_REGEX "[Uu]nknown option" # HP - FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro - 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 + ${_CheckCXXCompilerFlag_COMMON_PATTERNS} ) foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}}) unset(_CheckCXXCompilerFlag_SAVED_${v}) endforeach() unset(_CheckCXXCompilerFlag_LOCALE_VARS) + unset(_CheckCXXCompilerFlag_COMMON_PATTERNS) set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index ea2891c..d28cc2a 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -1,10 +1,12 @@ # - Check if the given struct or class has the specified member variable -# CHECK_STRUCT_HAS_MEMBER (STRUCT MEMBER HEADER VARIABLE) +# CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable> +# [LANGUAGE <language>]) # -# STRUCT - the name of the struct or class you are interested in -# MEMBER - the member which existence you want to check -# HEADER - the header(s) where the prototype should be declared -# VARIABLE - variable to store the result +# <struct> - the name of the struct or class you are interested in +# <member> - the member which existence you want to check +# <header> - the header(s) where the prototype should be declared +# <variable> - variable to store the result +# <language> - the compiler to use (C or CXX) # # The following variables may be set before calling this macro to # modify the way the check is run: @@ -12,8 +14,9 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # -# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC) +# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC LANGUAGE C) #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -29,6 +32,7 @@ # License text for the above reference.) include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) set(_INCLUDE_FILES) @@ -36,16 +40,29 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") endforeach () + if("x${ARGN}" STREQUAL "x") + set(_lang C) + elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$") + set(_lang "${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n") + endif() + set(_CHECK_STRUCT_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { ${_STRUCT}* tmp; tmp->${_MEMBER}; - return 0; + return 0; } ") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + if("${_lang}" STREQUAL "C") + CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + elseif("${_lang}" STREQUAL "CXX") + CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + else() + message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") + endif() endmacro () - diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 77aac6d..316a2da 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -240,6 +240,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) PATH_SUFFIXES ${_suffixes} ) + mark_as_advanced(GTK2_${_var}_INCLUDE_DIR) if(${_var}_INCLUDE_DIR) set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}_INCLUDE_DIR} PARENT_SCOPE) @@ -449,7 +450,7 @@ endif() # Find all components # -find_package(Freetype) +find_package(Freetype QUIET) list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) @@ -586,6 +587,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER) + set(GTK2_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK2_FIND_QUIETLY}) + if(_GTK2_component STREQUAL "gtk") FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found." GTK2_GTK_LIBRARY diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake new file mode 100644 index 0000000..31fe54c --- /dev/null +++ b/Modules/FindLua.cmake @@ -0,0 +1,153 @@ +# Locate Lua library +# This module defines +# LUA_FOUND - if false, do not try to link to Lua +# LUA_LIBRARIES - both lua and lualib +# LUA_INCLUDE_DIR - where to find lua.h +# LUA_VERSION_STRING - the version of Lua found +# LUA_VERSION_MAJOR - the major version of Lua +# LUA_VERSION_MINOR - the minor version of Lua +# LUA_VERSION_PATCH - the patch version of Lua +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include <lua/lua.h> +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de> +# +# 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.) + +unset(_lua_include_subdirs) +unset(_lua_library_names) + +# this is a function only to have all the variables inside go away automatically +function(set_lua_version_vars) + set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + + if (Lua_FIND_VERSION_EXACT) + if (Lua_FIND_VERSION_COUNT GREATER 1) + set(lua_append_versions ${Lua_FIND_VERSION_MAJOR} ${Lua_FIND_VERSION_MINOR}) + endif () + elseif (Lua_FIND_VERSION) + # once there is a different major version supported this should become a loop + if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) + if (Lua_FIND_VERSION_COUNT EQUAL 1) + set(lua_append_versions ${LUA_VERSIONS5}) + else () + foreach (subver IN LISTS LUA_VERSIONS5) + if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) + list(APPEND lua_append_versions ${subver}) + endif () + endforeach () + endif () + endif () + else () + # once there is a different major version supported this should become a loop + set(lua_append_versions ${LUA_VERSIONS5}) + endif () + + foreach (ver IN LISTS lua_append_versions) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") + list(APPEND _lua_include_subdirs + include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + list(APPEND _lua_library_names + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + endforeach () + + set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) + set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) +endfunction(set_lua_version_vars) + +set_lua_version_vars() + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES ${_lua_include_subdirs} include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) +unset(_lua_include_subdirs) + +find_library(LUA_LIBRARY + NAMES ${_lua_library_names} lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) +unset(_lua_library_names) + +if (LUA_LIBRARY) + # include the math library for Unix + if (UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") + # For Windows and Mac, don't need to explicitly include the math library + else () + set(LUA_LIBRARIES "${LUA_LIBRARY}") + endif () +endif () + +if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + + unset(lua_version_strings) +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(Lua + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 9851f67..b610438 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -138,6 +138,8 @@ if(WIN32 AND NOT CYGWIN) select_library_configurations(LIB_EAY) select_library_configurations(SSL_EAY) + mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE + SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 7fb65b8..b6b7897 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -36,28 +36,30 @@ 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}) + if(PythonInterp_FIND_VERSION_COUNT GREATER 1) + set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}") + list(APPEND _Python_NAMES + python${_PYTHON_FIND_MAJ_MIN} + python${PythonInterp_FIND_VERSION_MAJOR}) unset(_PYTHON_FIND_OTHER_VERSIONS) if(NOT PythonInterp_FIND_VERSION_EXACT) - foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS}) if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() endif() unset(_PYTHON_FIND_MAJ_MIN) - unset(_PYTHON_FIND_MAJ) else() - list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION}) - set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS}) + list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS}) endif() else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) endif() +message(STATUS "names ${_Python_NAMES}") +message(STATUS "other versions ${_PYTHON_FIND_OTHER_VERSIONS}") list(APPEND _Python_NAMES python) # Search for the current active python version first diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index bffa9fb..8356ed9 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -41,9 +41,8 @@ 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(PythonLibs_FIND_VERSION) - if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") - string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + if(PythonLibs_FIND_VERSION_COUNT GREATER 1) + set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}") unset(_PYTHON_FIND_OTHER_VERSIONS) if(PythonLibs_FIND_VERSION_EXACT) if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) @@ -52,16 +51,15 @@ if(PythonLibs_FIND_VERSION) set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") endif() else() - foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS}) if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() endif() unset(_PYTHON_FIND_MAJ_MIN) - unset(_PYTHON_FIND_MAJ) else() - set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS}) endif() else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 37a894c..28c1b64 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -475,6 +475,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # settings. if(MINGW) set(WX_LIB_DIR_PREFIX gcc) + elseif(CMAKE_CL_64) + set(WX_LIB_DIR_PREFIX vc_x64) else() set(WX_LIB_DIR_PREFIX vc) endif() diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 798c44c..afeb9c5 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -49,7 +49,7 @@ unset(FortranCInterface_COMPILED CACHE) # Locate the sample project executable. if(FortranCInterface_COMPILED) find_program(FortranCInterface_EXE - NAMES FortranCInterface + NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX} PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug NO_DEFAULT_PATH ) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 4ef14ac..b2fda09 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -1,6 +1,5 @@ # - Function for generation of export macros for libraries -# This module provides the function GENERATE_EXPORT_HEADER() and the -# accompanying ADD_COMPILER_EXPORT_FLAGS() function. +# This module provides the function GENERATE_EXPORT_HEADER(). # # The GENERATE_EXPORT_HEADER function can be used to generate a file suitable # for preprocessor inclusion which contains EXPORT macros to be used in @@ -18,20 +17,17 @@ # [PREFIX_NAME <prefix_name>] # ) # -# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# The target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN +# can be used to add the appropriate compile flags for targets. See the +# documentation of those target properties, and the convenience variables +# CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN. # # By default GENERATE_EXPORT_HEADER() generates macro names in a file name -# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function -# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on -# Windows which does not need extra compiler flags for exporting support. You -# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will -# be populated with the required CXX_FLAGS required to enable visibility support -# for the compiler/architecture in use. +# determined by the name of the library. This means that in the simplest case, +# users of generate_export_header will be equivalent to: # -# This means that in the simplest case, users of these functions will be -# equivalent to: -# -# add_compiler_export_flags() +# set(CMAKE_CXX_VISIBILITY_PRESET hidden) +# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # add_library(somelib someclass.cpp) # generate_export_header(somelib) # install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR}) @@ -128,6 +124,20 @@ # generate_export_header(somelib PREFIX_NAME VTK_) # # Generates the macros VTK_SOMELIB_EXPORT etc. +# +# +# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# +# The ADD_COMPILER_EXPORT_FLAGS function +# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on +# Windows which does not need extra compiler flags for exporting support. You +# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will +# be populated with the required CXX_FLAGS required to enable visibility support +# for the compiler/architecture in use. +# +# This function is deprecated. Set the target properties CXX_VISIBILITY_PRESET +# and VISIBILITY_INLINES_HIDDEN instead. +# #============================================================================= # Copyright 2011 Stephen Kelly <steveire@gmail.com> @@ -326,6 +336,17 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) endfunction() function(add_compiler_export_flags) + if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) + if(CMAKE_WARN_DEPRECATED) + set(messageType WARNING) + endif() + if(CMAKE_ERROR_DEPRECATED) + set(messageType FATAL_ERROR) + endif() + if(messageType) + message(${messageType} "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") + endif() + endif() _test_compiler_hidden_visibility() _test_compiler_has_deprecated() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index c0fd07c..c9635b5 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -49,6 +49,11 @@ # # add_jar(example ENTRY_POINT com/examples/MyProject/Main) # +# To define a custom manifest for the jar, you can set it with the manifest +# named argument: +# +# add_jar(example MANIFEST /path/to/manifest) +# # To add a VERSION to the target output name you can set it using # the VERSION named argument to add_jar. This will create a jar file with the # name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar @@ -246,7 +251,7 @@ function(add_jar _TARGET_NAME) cmake_parse_arguments(_add_jar "" - "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" "SOURCES;INCLUDE_JARS" ${ARGN} ) @@ -262,6 +267,11 @@ function(add_jar _TARGET_NAME) set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT}) endif () + if (_add_jar_MANIFEST) + set(_MANIFEST_OPTION m) + set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + endif () + if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) else () @@ -405,7 +415,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} @@ -425,7 +435,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in index 80a879d..118de16 100644 --- a/Modules/exportheader.cmake.in +++ b/Modules/exportheader.cmake.in @@ -23,8 +23,14 @@ #ifndef @DEPRECATED_MACRO_NAME@ # define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@ -# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@ -# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_EXPORT +# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT +# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ #endif #cmakedefine01 DEFINE_NO_DEPRECATED |