diff options
Diffstat (limited to 'Modules')
72 files changed, 724 insertions, 332 deletions
diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in index 640bf70..9cff735 100644 --- a/Modules/AutomocInfo.cmake.in +++ b/Modules/AutomocInfo.cmake.in @@ -6,10 +6,9 @@ set(AM_MOC_OPTIONS @_moc_options@) set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@") set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/") set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/") -set(AM_QT_MOC_EXECUTABLE "@QT_MOC_EXECUTABLE@") +set(AM_QT_MOC_EXECUTABLE "@_qt_moc_executable@") set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/") set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") -set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" ) -set(AM_Qt5Core_VERSION_MAJOR "@Qt5Core_VERSION_MAJOR@" ) +set(AM_QT_VERSION_MAJOR "@_target_qt_version@") set(AM_TARGET_NAME @_moc_target_name@) set(AM_RELAXED_MODE "@_moc_relaxed_mode@") diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index e3b6c82..4783d68 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -55,7 +55,7 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN) include (FindX11) - if("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$") + if("${X11_X11_INCLUDE_PATH}" STREQUAL "/usr/include") set (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.") else() set (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index c25df0c..66a5582 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -160,10 +160,9 @@ # define COMPILER_ID "ADSP" /* IAR Systems compiler for embedded systems. - http://www.iar.com - Not supported yet by CMake -#elif defined(__IAR_SYSTEMS_ICC__) -# define COMPILER_ID "IAR" */ + http://www.iar.com */ +#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" /* sdcc, the small devices C compiler for embedded systems, http://sdcc.sourceforge.net */ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index e2119c2..5e87715 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -161,6 +161,11 @@ #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) # define COMPILER_ID "ADSP" +/* IAR Systems compiler for embedded systems. + http://www.iar.com */ +#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" + #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) # define COMPILER_ID "MIPSpro" # if defined(_SGI_COMPILER_VERSION) diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake index cec09e9..03c5668 100644 --- a/Modules/CMakeDetermineASM-ATTCompiler.cmake +++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake @@ -15,6 +15,6 @@ # determine the compiler to use for ASM using AT&T syntax, e.g. GNU as set(ASM_DIALECT "-ATT") -set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as) +set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as) include(CMakeDetermineASMCompiler) set(ASM_DIALECT) diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 9999f62..0fecb5d 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -39,8 +39,8 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) endif() endif() else() # some specific assembler "dialect" - if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !") + if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT AND NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST) + message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT or CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST must be preset !") endif() endif() @@ -103,6 +103,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI "-h") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI "Texas Instruments") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU IAR) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler") + include(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake index 50f71dd..5d783b1 100644 --- a/Modules/CMakeDetermineASM_NASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -14,7 +14,7 @@ # Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible -set(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm) +set(CMAKE_ASM_NASM_COMPILER_LIST nasm yasm) if(NOT CMAKE_ASM_NASM_COMPILER) find_program(CMAKE_ASM_NASM_COMPILER nasm diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index d2220e0..8769c66 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -120,6 +120,13 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) set(CMAKE_C_COMPILER_ID) file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in CMAKE_C_COMPILER_ID_PLATFORM_CONTENT) + + # The IAR compiler produces weird output. + # See http://www.cmake.org/Bug/view.php?id=10176#c19598 + list(APPEND CMAKE_C_COMPILER_ID_VENDORS IAR) + set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR ) + set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler") + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 6f7e8f6..c79ba89 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -116,6 +116,13 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) set(CMAKE_CXX_COMPILER_ID) file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT) + + # The IAR compiler produces weird output. + # See http://www.cmake.org/Bug/view.php?id=10176#c19598 + list(APPEND CMAKE_CXX_COMPILER_ID_VENDORS IAR) + set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR ) + set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler") + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 25d6bbe..44cc04a 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -28,6 +28,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") endif() + if(CMAKE_${lang}_COMPILER_TARGET) + set(CMAKE_FLAGS "${CMAKE_FLAGS} -DCMAKE_${lang}_COMPILER_TARGET=${CMAKE_${lang}_COMPILER_TARGET}") + endif() try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} CMAKE_FLAGS "${CMAKE_FLAGS}" diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index b918092..ae91a29 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -131,6 +131,8 @@ Id flags: ${testflags} elseif("${id_arch}" STREQUAL "Itanium") set(id_machine_10 MachineIA64) set(id_arch ia64) + elseif("${id_arch}" STREQUAL "ARM") + set(id_machine_10 MachineARM) else() set(id_machine_6 x86) set(id_machine_10 MachineX86) diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index fa78da0..c4600c7 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -12,14 +12,14 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# determine the compiler to use for C programs -# NOTE, a generator may set CMAKE_C_COMPILER before +# determine the compiler to use for RC programs +# NOTE, a generator may set CMAKE_RC_COMPILER before # loading this file to force a compiler. -# use environment variable CCC first if defined by user, next use -# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator +# use environment variable RC first if defined by user, next use +# the cmake variable CMAKE_GENERATOR_RC which can be defined by a generator # as a default compiler if(NOT CMAKE_RC_COMPILER) - # prefer the environment variable CC + # prefer the environment variable RC if($ENV{RC} MATCHES ".+") get_filename_component(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT) if(CMAKE_RC_FLAGS_ENV_INIT) diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 98e5bb8..17b4bbf 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -1,32 +1,25 @@ -# - Includes a public function for assisting users in trying to determine the -# Visual Studio service pack in use. -# -# Sets the passed in variable to one of the following values or an empty -# string if unknown. -# vc80 -# vc80sp1 -# vc90 -# vc90sp1 -# vc100 -# vc100sp1 -# vc110 +# - Determine the Visual Studio service pack of the 'cl' in use. +# The functionality of this module has been superseded by the platform +# variable CMAKE_<LANG>_COMPILER_VERSION that contains the compiler version +# number. # # Usage: -# =========================== -# -# if(MSVC) -# include(CMakeDetermineVSServicePack) -# DetermineVSServicePack( my_service_pack ) -# -# if( my_service_pack ) -# message(STATUS "Detected: ${my_service_pack}") -# endif() +# if(MSVC) +# include(CMakeDetermineVSServicePack) +# DetermineVSServicePack( my_service_pack ) +# if( my_service_pack ) +# message(STATUS "Detected: ${my_service_pack}") # endif() -# -# =========================== +# endif() +# Function DetermineVSServicePack sets the given variable to one of the +# following values or an empty string if unknown: +# vc80, vc80sp1 +# vc90, vc90sp1 +# vc100, vc100sp1 +# vc110, vc110sp1, vc110sp2 #============================================================================= -# Copyright 2009-2011 Kitware, Inc. +# Copyright 2009-2013 Kitware, Inc. # Copyright 2009-2010 Philip Lowman <philip@yhbt.com> # Copyright 2010-2011 Aaron C. meadows <cmake@shadowguarddev.com> # @@ -57,6 +50,10 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc100sp1") elseif(${_cl_version} VERSION_EQUAL "17.00.50727.1") set(_version "vc110") + elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1") + set(_version "vc110sp1") + elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1") + set(_version "vc110sp2") else() set(_version "") endif() diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index cea0187..e5216f4 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -3,7 +3,7 @@ # NAME = name of the package # COMPILER_ID = the CMake compiler ID for which the result is, i.e. GNU/Intel/Clang/MSVC, etc. # LANGUAGE = language for which the result will be used, i.e. C/CXX/Fortan/ASM -# MODE = EXIST : only check for existance of the given package +# MODE = EXIST : only check for existence of the given package # COMPILE : print the flags needed for compiling an object file which uses the given package # LINK : print the flags needed for linking when using the given package # QUIET = if TRUE, don't print anything diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake index 406780e..016da0c 100644 --- a/Modules/CMakeParseArguments.cmake +++ b/Modules/CMakeParseArguments.cmake @@ -51,7 +51,7 @@ # MY_INSTALL_CONFIGURATIONS = "" (was not used) # MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" # -# You can the continue and process these variables. +# You can then continue and process these variables. # # Keywords terminate lists of values, e.g. if directly after a one_value_keyword # another recognized keyword follows, this is interpreted as the beginning of diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 80e0218..4724a8c 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -26,10 +26,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(linker "CMAKE_LINKER-NOTFOUND") if(CMAKE_LINKER) get_filename_component(linker ${CMAKE_LINKER} NAME) + string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}") endif() # Construct a regex to match linker lines. It must match both the # whole line and just the command (argv[0]). - set(linker_regex "^( *|.*[/\\])(${linker}|ld|collect2)[^/\\]*( |$)") + set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") set(linker_exclude_regex "collect2 version ") set(log "${log} link line regex: [${linker_regex}]\n") string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in index 7e2a358..70c98d5 100644 --- a/Modules/CMakeSystem.cmake.in +++ b/Modules/CMakeSystem.cmake.in @@ -1,3 +1,8 @@ +set(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") +set(CMAKE_HOST_SYSTEM_NAME "@CMAKE_HOST_SYSTEM_NAME@") +set(CMAKE_HOST_SYSTEM_VERSION "@CMAKE_HOST_SYSTEM_VERSION@") +set(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@") + @INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED@ set(CMAKE_SYSTEM "@CMAKE_SYSTEM@") @@ -5,11 +10,6 @@ set(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") set(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@") set(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") -set(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") -set(CMAKE_HOST_SYSTEM_NAME "@CMAKE_HOST_SYSTEM_NAME@") -set(CMAKE_HOST_SYSTEM_VERSION "@CMAKE_HOST_SYSTEM_VERSION@") -set(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@") - set(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@") set(CMAKE_SYSTEM_LOADED 1) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 42d3c0c..b0260ab 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -263,8 +263,8 @@ # ##variable # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when -# installing this project. This is only used -# by installer for Windows. +# installing this project. This is only used by installer for Windows. +# The default value is based on the installation directory. ##end ##variable # CPACK_CREATE_DESKTOP_LINKS - List of desktop links to create. diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake index 45ba465..98ca9e2 100644 --- a/Modules/CPackPackageMaker.cmake +++ b/Modules/CPackPackageMaker.cmake @@ -2,7 +2,7 @@ ##end ##module # - PackageMaker CPack generator (Mac OS X). -# The following variable is specific to installers build on Mac OS X +# The following variable is specific to installers built on Mac OS X # using PackageMaker: ##end # diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index fa79e1b..52fdc91 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -163,6 +163,8 @@ # 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). +# One can provide a component specific file by setting +# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE. ##end ##variable # CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template. @@ -223,6 +225,24 @@ # The refered file will be read and directly put after the %changelog # section. ##end +##variable +# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST - list of path to be excluded. +# Mandatory : NO +# Default : /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include +# May be used to exclude path (directories or files) from the auto-generated +# list of paths discovered by CPack RPM. The defaut value contains a reasonable +# set of values if the variable is not defined by the user. If the variable +# is defined by the user then CPackRPM will NOT any of the default path. +# If you want to add some path to the default list then you can use +# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION variable. +##end +##variable +# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION - additional list of path to be excluded. +# Mandatory : NO +# Default : - +# May be used to add more exclude path (directories or files) from the initial +# default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST. +##end #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -666,6 +686,30 @@ if(CPACK_RPM_PACKAGE_RELOCATABLE) endforeach() endif() +if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") +endif() + +if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) + if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) + message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") + endif() +endif() + +if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") + endif() + foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) + list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") + endforeach() +endif() +if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") +endif() + # Use files tree to construct files command (spec file) # We should not forget to include symlinks (thus -o -type l) # We should include directory as well (thus -type d) @@ -832,11 +876,18 @@ if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") endif() -# USER generated spec file handling. -# We should generate a spec file template: +# +# USER generated/provided spec file handling. +# + +# We can have a component specific spec file. +if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE) + set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) +endif() + +# We should generate a USER spec file template: # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE -# if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- @@ -902,9 +953,9 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -${CPACK_RPM_INSTALL_FILES} -${CPACK_RPM_ABSOLUTE_INSTALL_FILES} -${CPACK_RPM_USER_INSTALL_FILES} +\@CPACK_RPM_INSTALL_FILES\@ +\@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@ +\@CPACK_RPM_USER_INSTALL_FILES\@ %changelog \@CPACK_RPM_SPEC_CHANGELOG\@ diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 562e248..5cd62f6 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -84,13 +84,13 @@ if(BUILD_TESTING) endmacro() macro(SET_IF_SET var val) - if(NOT "${val}" MATCHES "^$") + if(NOT "${val}" STREQUAL "") set("${var}" "${val}") endif() endmacro() macro(SET_IF_SET_AND_NOT_SET var val) - if(NOT "${val}" MATCHES "^$") + if(NOT "${val}" STREQUAL "") SET_IF_NOT_SET("${var}" "${val}") endif() endmacro() diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 08e80f7..02f7cb6 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -26,6 +26,12 @@ include(CheckCSourceCompiles) 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_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 @@ -41,5 +47,11 @@ macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "command option .* is not recognized" # XL FAIL_REGEX "WARNING: unknown flag:" # Open64 ) + foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) + set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) + unset(_CheckCCompilerFlag_SAVED_${v}) + endforeach() + unset(_CheckCCompilerFlag_LOCALE_VARS) + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 6626403..a872a75 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -26,6 +26,13 @@ include(CheckCXXSourceCompiles) macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + + # Normalize locale during test compilation. + set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) + foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) + set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}") + set(ENV{${v}} C) + endforeach() 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 @@ -43,6 +50,12 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "File with unknown suffix passed to linker" # PGI FAIL_REGEX "WARNING: unknown flag:" # Open64 ) + foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) + set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}}) + unset(_CheckCXXCompilerFlag_SAVED_${v}) + endforeach() + unset(_CheckCXXCompilerFlag_LOCALE_VARS) + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 7aa1748..ead1354 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -4,7 +4,7 @@ # Check that the <function> is provided by libraries on the system and # store the result in a <variable>. This does not verify that any # system header file declares the function, only that it can be found -# at link time (considure using CheckSymbolExists). +# at link time (consider using CheckSymbolExists). # # The following variables may be set before calling this macro to # modify the way the check is run: diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake index 9f587b5..f0707df 100644 --- a/Modules/CheckSizeOf.cmake +++ b/Modules/CheckSizeOf.cmake @@ -15,4 +15,4 @@ message(SEND_ERROR "Modules/CheckSizeOf.cmake has been removed. " "Use Modules/CheckTypeSize.cmake instead. This " - "compatability check may be removed before the next release!") + "compatibility check may be removed before the next release!") diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 486e2af..972d889 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -1,2 +1,4 @@ include(Compiler/Clang) __compiler_clang(CXX) + +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index c6cd8f8..66b00bd 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -24,4 +24,6 @@ macro(__compiler_clang lang) __compiler_gnu(${lang}) set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + set(CMAKE_${lang}_COMPILE_OPTION_TARGET "-target ") endmacro() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 879ab8f..33d6093 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -1,2 +1,12 @@ include(Compiler/GNU) __compiler_gnu(CXX) + +if (WIN32) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport") + endif() +else() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2) + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") + endif() +endif() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index faad416..e5e10c3 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -25,8 +25,12 @@ macro(__compiler_gnu lang) if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") endif() + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.2) + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + endif() set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + set(CMAKE_SYSROOT_FLAG "--sysroot=") # Older versions of gcc (< 4.5) contain a bug causing them to report a missing # header file as a warning if depfiles are enabled, causing check_header_file diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake new file mode 100644 index 0000000..66fb052 --- /dev/null +++ b/Modules/Compiler/IAR-ASM.cmake @@ -0,0 +1,14 @@ +# This file is processed when the IAR compiler is used for an assembler file + +include(Compiler/IAR) + +set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>") + +if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) +endif() + + +if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "AVR") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) +endif() diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake new file mode 100644 index 0000000..da29447 --- /dev/null +++ b/Modules/Compiler/IAR-C.cmake @@ -0,0 +1,34 @@ +# This file is processed when the IAR compiler is used for a C file + + +include(Compiler/IAR) + +set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") + +# The toolchains for ARM and AVR are quite different: +if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") + + set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS> ") + +endif() + + +if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "AVR") + set(CMAKE_C_OUTPUT_EXTENSION ".r90") + + if(NOT CMAKE_C_LINK_FLAGS) + set(CMAKE_C_LINK_FLAGS "-Fmotorola") + endif() + + set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> -o <TARGET> <OBJECTS> ") + +endif() + +# add the target specific include directory: +get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) +get_filename_component(_compilerDir "${_compilerDir}" PATH) +include_directories("${_compilerDir}/inc" ) diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake new file mode 100644 index 0000000..eae9d1b --- /dev/null +++ b/Modules/Compiler/IAR-CXX.cmake @@ -0,0 +1,34 @@ +# This file is processed when the IAR compiler is used for a C++ file + +include(Compiler/IAR) + +set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>") + +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") + + + +if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") + + set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS> ") + +endif() + + +if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "AVR") + set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") + if(NOT CMAKE_CXX_LINK_FLAGS) + set(CMAKE_CXX_LINK_FLAGS "-Fmotorola") + endif() + + set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> -o <TARGET> <OBJECTS> ") + +endif() + +# add the target specific include directory: +get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) +get_filename_component(_compilerDir "${_compilerDir}" PATH) +include_directories("${_compilerDir}/inc") diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake new file mode 100644 index 0000000..00e4713 --- /dev/null +++ b/Modules/Compiler/IAR.cmake @@ -0,0 +1,46 @@ +# This file is processed when the IAR compiler is used for a C or C++ file +# Documentation can be downloaded here: http://www.iar.com/website1/1.0.1.0/675/1/ +# The initial feature request is here: http://www.cmake.org/Bug/view.php?id=10176 +# It also contains additional links and information. + +if(_IAR_CMAKE_LOADED) + return() +endif() +set(_IAR_CMAKE_LOADED TRUE) + + +get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) +get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) +get_filename_component(_CMAKE_ASM_TOOLCHAIN_LOCATION "${CMAKE_ASM_COMPILER}" PATH) + + +if("${CMAKE_C_COMPILER}" MATCHES "arm" OR "${CMAKE_CXX_COMPILER}" MATCHES "arm" OR "${CMAKE_ASM_COMPILER}" MATCHES "arm") + set(CMAKE_EXECUTABLE_SUFFIX ".elf") + + # For arm, IAR uses the "ilinkarm" linker and "iarchive" archiver: + find_program(CMAKE_IAR_LINKER ilinkarm HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" "${_CMAKE_ASM_TOOLCHAIN_LOCATION}") + find_program(CMAKE_IAR_AR iarchive HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" "${_CMAKE_ASM_TOOLCHAIN_LOCATION}" ) + + set(IAR_TARGET_ARCHITECTURE "ARM" CACHE STRING "IAR compiler target architecture") +endif() + +if("${CMAKE_C_COMPILER}" MATCHES "avr" OR "${CMAKE_CXX_COMPILER}" MATCHES "avr" OR "${CMAKE_ASM_COMPILER}" MATCHES "avr") + set(CMAKE_EXECUTABLE_SUFFIX ".bin") + + # For AVR and AVR32, IAR uses the "xlink" linker and the "xar" archiver: + find_program(CMAKE_IAR_LINKER xlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" "${_CMAKE_ASM_TOOLCHAIN_LOCATION}" ) + find_program(CMAKE_IAR_AR xar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" "${_CMAKE_ASM_TOOLCHAIN_LOCATION}" ) + + set(IAR_TARGET_ARCHITECTURE "AVR" CACHE STRING "IAR compiler target architecture") + + set(CMAKE_LIBRARY_PATH_FLAG "-I") + +endif() + +if(NOT IAR_TARGET_ARCHITECTURE) + message(FATAL_ERROR "The IAR compiler for this architecture is not yet supported " + " by CMake. Please go to http://www.cmake.org/Bug and enter a feature request there.") +endif() + +set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE) +set(CMAKE_AR "${CMAKE_IAR_AR}" CACHE FILEPATH "The IAR archiver" FORCE) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index e23317c..5b43db9 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -6,5 +6,9 @@ set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) + set(CMAKE_C_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") +endif() + set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index ae6021a..35bb3ec 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -6,5 +6,9 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0) + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") +endif() + set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/CompilerId/Xcode-1.pbxproj.in b/Modules/CompilerId/Xcode-1.pbxproj.in index f06960f..793ad02 100644 --- a/Modules/CompilerId/Xcode-1.pbxproj.in +++ b/Modules/CompilerId/Xcode-1.pbxproj.in @@ -56,7 +56,7 @@ 2C18F0B415DC1DC700593670 = { fileEncoding = 30; isa = PBXFileReference; - lastKnownFileType = @id_type@; + explicitFileType = @id_type@; path = @id_src@; refType = 4; sourceTree = "<group>"; diff --git a/Modules/CompilerId/Xcode-2.pbxproj.in b/Modules/CompilerId/Xcode-2.pbxproj.in index e3c7aa9..226b413 100644 --- a/Modules/CompilerId/Xcode-2.pbxproj.in +++ b/Modules/CompilerId/Xcode-2.pbxproj.in @@ -7,7 +7,7 @@ objects = { 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; - 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; explicitFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; }; 8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; }; 08FB7794FE84155DC02AAC07 = { diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index d94a803..6f861eb 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -7,7 +7,7 @@ objects = { 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; - 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; explicitFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; }; 08FB7794FE84155DC02AAC07 = { isa = PBXGroup; children = ( diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 187f408..50669bd 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -391,7 +391,7 @@ function(_ExternalData_arg target arg options var_file) # Regular expression to match associated files. string(REGEX REPLACE "^REGEX:" "" regex "${opt}") list(APPEND associated_regex "${regex}") - elseif("x${opt}" MATCHES "^x:$") + elseif(opt STREQUAL ":") # Activate series matching. set(series_option "${opt}") elseif("x${opt}" MATCHES "^[^][:/*?]+$") @@ -551,7 +551,10 @@ function(_ExternalData_arg_find_files pattern regex) set(relname "${entry}") set(alg "") endif() - if("x${relname}" MATCHES "^x${regex}$" AND NOT IS_DIRECTORY "${top_src}/${entry}") + if("x${relname}" MATCHES "^x${regex}$" # matches + AND NOT IS_DIRECTORY "${top_src}/${entry}" # not a directory + AND NOT "x${relname}" MATCHES "(^x|/)\\.ExternalData_" # not staged obj + ) set(name "${top_src}/${relname}") set(file "${top_bin}/${relname}") if(alg) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 40e14d5..6afdb97 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1251,10 +1251,10 @@ function(_ep_add_download_command name) get_filename_component(work_dir "${source_dir}" PATH) set(comment "Performing download step (SVN checkout) for '${name}'") set(svn_user_pw_args "") - if(svn_username) + if(DEFINED svn_username) set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}") endif() - if(svn_password) + if(DEFINED svn_password) set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}") endif() if(svn_trust_cert) @@ -1473,10 +1473,10 @@ function(_ep_add_update_command name) get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) get_property(svn_trust_cert TARGET ${name} PROPERTY _EP_SVN_TRUST_CERT) set(svn_user_pw_args "") - if(svn_username) + if(DEFINED svn_username) set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}") endif() - if(svn_password) + if(DEFINED svn_password) set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}") endif() if(svn_trust_cert) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 92f8676..914a0a5 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -41,7 +41,7 @@ # Boost_LIBRARY_DIR - Directory containing Boost libraries # Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant # Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant -# Users may set the these hints or results as cache entries. Projects should +# Users may set these hints or results as cache entries. Projects should # not read these entries directly but instead use the above result variables. # Note that some hint names start in upper-case "BOOST". One may specify # these as environment variables if they are not specified as CMake variables @@ -154,7 +154,7 @@ #------------------------------------------------------------------------------- -# Before we go searching, check whether boost-cmake is avaialble, unless the +# Before we go searching, check whether boost-cmake is available, unless the # user specifically asked NOT to search for boost-cmake. # # If Boost_DIR is set, this behaves as any find_package call would. If not, @@ -247,7 +247,7 @@ macro(_Boost_ADJUST_LIB_VARS basename) endif() endif() - # Make variables changeble to the advanced user + # Make variables changeable to the advanced user mark_as_advanced( Boost_${basename}_LIBRARY_RELEASE Boost_${basename}_LIBRARY_DEBUG @@ -930,9 +930,13 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") endif() + + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}") + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE NAMES ${_boost_RELEASE_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} + HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} NAMES_PER_DIR DOC "${_boost_docstring_release}" ) @@ -962,9 +966,13 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") endif() + + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}") + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG NAMES ${_boost_DEBUG_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} + HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} NAMES_PER_DIR DOC "${_boost_docstring_debug}" ) @@ -1014,7 +1022,12 @@ if(Boost_FOUND) # We were unable to find some libraries, so generate a sensible # error message that lists the libraries we were unable to find. set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") + "${Boost_ERROR_REASON}\nCould not find the following") + if(Boost_USE_STATIC_LIBS) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static") + endif() + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON} Boost libraries:\n") foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) set(Boost_ERROR_REASON "${Boost_ERROR_REASON} boost_${COMPONENT}\n") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 423ad3d..5a680e3 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -920,7 +920,13 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path) if (IS_ABSOLUTE "${bpath}") # Absolute paths are generally unnessary, especially if something like # file(GLOB_RECURSE) is used to pick up the files. - file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}") + + string(FIND "${bpath}" "${CMAKE_CURRENT_BINARY_DIR}" _binary_dir_pos) + if (_binary_dir_pos EQUAL 0) + file(RELATIVE_PATH bpath "${CMAKE_CURRENT_BINARY_DIR}" "${bpath}") + else() + file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}") + endif() endif() # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the @@ -1021,7 +1027,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Initialize our list of includes with the user ones followed by the CUDA system ones. set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}") # Get the include directories for this directory and use them for our nvcc command. + # Remove duplicate entries which may be present since include_directories + # in CMake >= 2.8.8 does not remove them. get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES) + list(REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRECTORIES) if(CUDA_NVCC_INCLUDE_DIRECTORIES) foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES}) list(APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir}) diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index c2405f4..1b53d17 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -63,7 +63,7 @@ if (${depend_text} MATCHES ".+") if (EXISTS "/${file}") set(file "/${file}") else() - message(WARNING " Removing non-existant dependency file: ${file}") + message(WARNING " Removing non-existent dependency file: ${file}") set(file "") endif() endif() diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 071c318..09f6925 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -45,7 +45,7 @@ if(APPLE) set( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") endif() -# If FLTK2_INCLUDE_DIR is already defined we assigne its value to FLTK2_DIR +# If FLTK2_INCLUDE_DIR is already defined we assign its value to FLTK2_DIR if(FLTK2_INCLUDE_DIR) set(FLTK2_DIR ${FLTK2_INCLUDE_DIR}) else() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 1df2399..ccea991 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -50,6 +50,9 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h /usr/local/X11R6 /usr/local/X11 /usr/freeware + ENV GTKMM_BASEPATH + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] PATH_SUFFIXES include/freetype2 include ) @@ -61,6 +64,9 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h /usr/local/X11R6 /usr/local/X11 /usr/freeware + ENV GTKMM_BASEPATH + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] PATH_SUFFIXES include/freetype2 include ) @@ -70,10 +76,13 @@ find_library(FREETYPE_LIBRARY ENV FREETYPE_DIR PATH_SUFFIXES lib PATHS - /usr/X11R6 - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware + /usr/X11R6 + /usr/local/X11R6 + /usr/local/X11 + /usr/freeware + ENV GTKMM_BASEPATH + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] ) # set the user variables diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 06cf962..f398c79 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -164,6 +164,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) cairo cairomm-1.0 gdk-pixbuf-2.0 + gthread-2.0 gdkmm-2.4 giomm-2.4 gtk-2.0 @@ -460,9 +461,13 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h) _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true) + _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true) + _GTK2_FIND_LIBRARY (GTK2_GTHREAD_LIBRARY gthread false true) + _GTK2_FIND_LIBRARY (GTK2_GIO_LIBRARY gio false true) _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h) @@ -489,8 +494,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h) _GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true) - _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG_INCLUDE_DIR cairommconfig.h) _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true) diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake index b0b3f03..2929a76 100644 --- a/Modules/FindITK.cmake +++ b/Modules/FindITK.cmake @@ -17,7 +17,7 @@ # # USE_ITK_FILE - The full path to the UseITK.cmake file. # This is provided for backward -# compatability. Use ITK_USE_FILE +# compatibility. Use ITK_USE_FILE # instead. #============================================================================= @@ -52,6 +52,6 @@ if(NOT ITK_FOUND) endif() if(ITK_FOUND) - # Set USE_ITK_FILE for backward-compatability. + # Set USE_ITK_FILE for backward-compatibility. set(USE_ITK_FILE ${ITK_USE_FILE}) endif() diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index cd97b38..02a5777 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -81,7 +81,7 @@ function(FIND_IMAGEMAGICK_API component header) ${ImageMagick_INCLUDE_DIRS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" PATH_SUFFIXES - ImageMagick + ImageMagick ImageMagick-6 DOC "Path to the ImageMagick include dir." ) find_library(ImageMagick_${component}_LIBRARY diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 143d10a..0eb86a8 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -86,7 +86,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake) # # The compilers are detected in this order: # -# 1. Try to find the most generic availble MPI compiler, as this is usually set up by +# 1. Try to find the most generic available MPI compiler, as this is usually set up by # cluster admins. e.g., if plain old mpicc is available, we'll use it and assume it's # the right compiler. # diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 96c4d8d..83fcc3d 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -28,111 +28,107 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -if (WIN32) - if (CYGWIN) +set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY) - find_path(OPENGL_INCLUDE_DIR GL/gl.h ) +if (CYGWIN) - find_library(OPENGL_gl_LIBRARY opengl32 ) + find_path(OPENGL_INCLUDE_DIR GL/gl.h ) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) - find_library(OPENGL_glu_LIBRARY glu32 ) + find_library(OPENGL_gl_LIBRARY opengl32 ) - else () + find_library(OPENGL_glu_LIBRARY glu32 ) - if(BORLAND) - set (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32") - set (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32") - else() - set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32") - set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32") - endif() - - endif () +elseif (WIN32) -else () + if(BORLAND) + set (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32") + set (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32") + else() + set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32") + set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32") + endif() - if (APPLE) +elseif (APPLE) - find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") - find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") - find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") + find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") + find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) - else() - if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") - # Handle HP-UX cases where we only want to find OpenGL in either hpux64 - # or hpux32 depending on if we're doing a 64 bit build. - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(_OPENGL_LIB_PATH - /opt/graphics/OpenGL/lib/hpux32/) - else() - set(_OPENGL_LIB_PATH - /opt/graphics/OpenGL/lib/hpux64/ - /opt/graphics/OpenGL/lib/pa20_64) - endif() - elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku) +else() + if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") + # Handle HP-UX cases where we only want to find OpenGL in either hpux64 + # or hpux32 depending on if we're doing a 64 bit build. + if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(_OPENGL_LIB_PATH - /boot/develop/lib/x86) - set(_OPENGL_INCLUDE_PATH - /boot/develop/headers/os/opengl) + /opt/graphics/OpenGL/lib/hpux32/) + else() + set(_OPENGL_LIB_PATH + /opt/graphics/OpenGL/lib/hpux64/ + /opt/graphics/OpenGL/lib/pa20_64) endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku) + set(_OPENGL_LIB_PATH + /boot/develop/lib/x86) + set(_OPENGL_INCLUDE_PATH + /boot/develop/headers/os/opengl) + endif() - # The first line below is to make sure that the proper headers - # are used on a Linux machine with the NVidia drivers installed. - # They replace Mesa with NVidia's own library but normally do not - # install headers and that causes the linking to - # fail since the compiler finds the Mesa headers but NVidia's library. - # Make sure the NVIDIA directory comes BEFORE the others. - # - Atanas Georgiev <atanas@cs.columbia.edu> - - find_path(OPENGL_INCLUDE_DIR GL/gl.h - /usr/share/doc/NVIDIA_GLX-1.0/include - /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include - ${_OPENGL_INCLUDE_PATH} - ) - - find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h - /usr/share/doc/NVIDIA_GLX-1.0/include - /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include - ) - - find_library(OPENGL_gl_LIBRARY - NAMES GL MesaGL - PATHS /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/shlib /usr/X11R6/lib - ${_OPENGL_LIB_PATH} - ) - - unset(_OPENGL_INCLUDE_PATH) - unset(_OPENGL_LIB_PATH) - - # On Unix OpenGL most certainly always requires X11. - # Feel free to tighten up these conditions if you don't - # think this is always true. - # It's not true on OSX. - - if (OPENGL_gl_LIBRARY) - if(NOT X11_FOUND) - include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake) - endif() - if (X11_FOUND) - if (NOT APPLE) - set (OPENGL_LIBRARIES ${X11_LIBRARIES}) - endif () - endif () + # The first line below is to make sure that the proper headers + # are used on a Linux machine with the NVidia drivers installed. + # They replace Mesa with NVidia's own library but normally do not + # install headers and that causes the linking to + # fail since the compiler finds the Mesa headers but NVidia's library. + # Make sure the NVIDIA directory comes BEFORE the others. + # - Atanas Georgiev <atanas@cs.columbia.edu> + + find_path(OPENGL_INCLUDE_DIR GL/gl.h + /usr/share/doc/NVIDIA_GLX-1.0/include + /usr/openwin/share/include + /opt/graphics/OpenGL/include /usr/X11R6/include + ${_OPENGL_INCLUDE_PATH} + ) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) + + find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h + /usr/share/doc/NVIDIA_GLX-1.0/include + /usr/openwin/share/include + /opt/graphics/OpenGL/include /usr/X11R6/include + ) + + find_library(OPENGL_gl_LIBRARY + NAMES GL MesaGL + PATHS /opt/graphics/OpenGL/lib + /usr/openwin/lib + /usr/shlib /usr/X11R6/lib + ${_OPENGL_LIB_PATH} + ) + + unset(_OPENGL_INCLUDE_PATH) + unset(_OPENGL_LIB_PATH) + + # On Unix OpenGL most certainly always requires X11. + # Feel free to tighten up these conditions if you don't + # think this is always true. + + if (OPENGL_gl_LIBRARY) + if(NOT X11_FOUND) + include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake) + endif() + if (X11_FOUND) + set (OPENGL_LIBRARIES ${X11_LIBRARIES}) endif () + endif () - find_library(OPENGL_glu_LIBRARY - NAMES GLU MesaGLU - PATHS ${OPENGL_gl_LIBRARY} - /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/shlib /usr/X11R6/lib - ) + find_library(OPENGL_glu_LIBRARY + NAMES GLU MesaGLU + PATHS ${OPENGL_gl_LIBRARY} + /opt/graphics/OpenGL/lib + /usr/openwin/lib + /usr/shlib /usr/X11R6/lib + ) - endif() endif () if(OPENGL_gl_LIBRARY) @@ -162,7 +158,8 @@ set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) # handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL DEFAULT_MSG OPENGL_gl_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}) +unset(_OpenGL_REQUIRED_VARS) mark_as_advanced( OPENGL_INCLUDE_DIR diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 224c88e..9851f67 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -140,10 +140,10 @@ if(WIN32 AND NOT CYGWIN) set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) - # same player, for MingW + # same player, for MinGW set(LIB_EAY_NAMES libeay32) set(SSL_EAY_NAMES ssleay32) - if(CMAKE_CROSS_COMPILING) + if(CMAKE_CROSSCOMPILING) list(APPEND LIB_EAY_NAMES crypto) list(APPEND SSL_EAY_NAMES ssl) endif() diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index af0c2dd..2972198 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -156,6 +156,16 @@ function(_protobuf_find_libraries name filename) endif() endfunction() +# Internal function: find threads library +function(_protobuf_find_threads) + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + find_package(Threads) + if(Threads_FOUND) + list(APPEND PROTOBUF_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + set(PROTOBUF_LIBRARIES "${PROTOBUF_LIBRARIES}" PARENT_SCOPE) + endif() +endfunction() + # # Main. # @@ -190,6 +200,9 @@ if(MSVC) set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}") endif() +if(UNIX) + _protobuf_find_threads() +endif() # Find the include directory find_path(PROTOBUF_INCLUDE_DIR diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 21e8e91..8ce1934 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -115,7 +115,7 @@ # You should have a look on the AUTOMOC property for targets to achieve the same results. # # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename) -# Create a the interface header and implementation files with the +# Create the interface header and implementation files with the # given basename from the given interface xml file and add it to # the list of sources. # @@ -171,7 +171,7 @@ # in: ts_files # generates commands to create .qm from .ts - files. The generated # filenames can be found in qm_files. The ts_files -# must exists and are not updated in any way. +# must exist and are not updated in any way. # # function QT4_USE_MODULES( target [link_type] modules...) # Make <target> use the <modules> from Qt. Using a Qt module means @@ -495,7 +495,7 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename) set(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES}) endif () - # Make variables changeble to the advanced user + # Make variables changeable to the advanced user mark_as_advanced(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) endmacro () @@ -635,10 +635,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) ) endif() - # try dropping a hint if trying to use Visual Studio with Qt built by mingw + # try dropping a hint if trying to use Visual Studio with Qt built by MinGW if(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) if(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) - message( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw. Those compilers do not produce code compatible with each other.") + message( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by MinGW. Those compilers do not produce code compatible with each other.") endif() endif() @@ -657,8 +657,11 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) 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.") + set(Qt4_FOUND FALSE) if(Qt4_FIND_REQUIRED) message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") + else() + return() endif() endif() @@ -771,7 +774,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endif() endif () - # Make variables changeble to the advanced user + # Make variables changeable to the advanced user mark_as_advanced( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) @@ -881,16 +884,20 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endforeach() if(Q_WS_WIN) - set(QT_MODULES ${QT_MODULES} QAxContainer QAxServer) - # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR - find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt - PATHS ${QT_HEADERS_DIR}/ActiveQt - NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH - ) - find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt - PATHS ${QT_HEADERS_DIR}/ActiveQt - NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH - ) + if (QT_QAXCONTAINER_FOUND) + set(QT_MODULES ${QT_MODULES} QAxContainer) + # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR + find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt + PATHS ${QT_HEADERS_DIR}/ActiveQt + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH + ) + endif() + if (QT_QAXSERVER_FOUND) + find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt + PATHS ${QT_HEADERS_DIR}/ActiveQt + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH + ) + endif() endif() # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR @@ -1051,14 +1058,18 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) if(Q_WS_WIN) _QT4_ADJUST_LIB_VARS(qtmain) - _QT4_ADJUST_LIB_VARS(QAxServer) - set_property(TARGET Qt4::QAxServer PROPERTY - INTERFACE_QT4_NO_LINK_QTMAIN ON - ) - set_property(TARGET Qt4::QAxServer APPEND PROPERTY - COMPATIBLE_INTERFACE_BOOL QT4_NO_LINK_QTMAIN) + if(QT_QAXSERVER_FOUND) + _QT4_ADJUST_LIB_VARS(QAxServer) + set_property(TARGET Qt4::QAxServer PROPERTY + INTERFACE_QT4_NO_LINK_QTMAIN ON + ) + set_property(TARGET Qt4::QAxServer APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL QT4_NO_LINK_QTMAIN) + endif() - _QT4_ADJUST_LIB_VARS(QAxContainer) + if(QT_QAXCONTAINER_FOUND) + _QT4_ADJUST_LIB_VARS(QAxContainer) + endif() endif() # Only public dependencies are listed here. @@ -1080,7 +1091,9 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) _qt4_add_target_depends(QtWebKit Gui Network) _qt4_add_target_private_depends(Qt3Support Xml) - _qt4_add_target_private_depends(QtSvg Xml) + if(QT_VERSION VERSION_GREATER 4.6) + _qt4_add_target_private_depends(QtSvg Xml) + endif() _qt4_add_target_private_depends(QtDBus Xml) _qt4_add_target_private_depends(QtUiTools Xml Gui) _qt4_add_target_private_depends(QtHelp Sql Xml Network) @@ -1090,8 +1103,12 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) _qt4_add_target_private_depends(QtDeclarative XmlPatterns Svg Sql Gui) _qt4_add_target_private_depends(QtMultimedia Gui) _qt4_add_target_private_depends(QtOpenGL Gui) - _qt4_add_target_private_depends(QAxServer Gui) - _qt4_add_target_private_depends(QAxContainer Gui) + if(QT_QAXSERVER_FOUND) + _qt4_add_target_private_depends(QAxServer Gui) + endif() + if(QT_QAXCONTAINER_FOUND) + _qt4_add_target_private_depends(QAxContainer Gui) + endif() _qt4_add_target_private_depends(phonon Gui) if(QT_QTDBUS_FOUND) _qt4_add_target_private_depends(phonon DBus) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 5d76777..f03908e 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -93,7 +93,7 @@ else() COMPILE_OUTPUT_VARIABLE OUTPUT) if(THREADS_HAVE_PTHREAD_ARG) - if(THREADS_PTHREAD_ARG MATCHES "^2$") + if(THREADS_PTHREAD_ARG STREQUAL "2") set(Threads_FOUND TRUE) message(STATUS "Check if compiler accepts -pthread - yes") else() diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index 0dede2d..085d60d 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -51,7 +51,7 @@ if("${VTK_FIND_VERSION}" VERSION_LESS 4.1) endif() endif() -# Construct consitent error messages for use below. +# Construct consistent error messages for use below. set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") if(_VTK_40_ALLOW) set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") @@ -127,7 +127,7 @@ endif() #----------------------------------------------------------------------------- if(VTK_FOUND) - # Set USE_VTK_FILE for backward-compatability. + # Set USE_VTK_FILE for backward-compatibility. set(USE_VTK_FILE ${VTK_USE_FILE}) else() # VTK not found, explain to the user how to specify its location. diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 3cd3cef..131d979 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -68,6 +68,7 @@ if (UNIX) /usr/openwin/include /usr/openwin/share/include /opt/graphics/OpenGL/include + /opt/X11/include ) set(X11_LIB_SEARCH_PATH @@ -75,6 +76,7 @@ if (UNIX) /usr/X11R6/lib /usr/X11R7/lib /usr/openwin/lib + /opt/X11/lib ) find_path(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH}) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index 6bb578b..c80249b 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -53,7 +53,7 @@ if(XMLRPC_FOUND) endif() # Parse the include flags. - if("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0") # Convert the compile flags to a CMake list. string(REGEX REPLACE " +" ";" XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}") @@ -91,7 +91,7 @@ if(XMLRPC_FOUND) endif() # Parse the library names and directories. - if("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0") string(REGEX REPLACE " +" ";" XMLRPC_C_CONFIG_LIBS "${XMLRPC_C_CONFIG_LIBS}") diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 218d476..37a894c 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -458,7 +458,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") wxWidgets-2.5.2 wxWidgets-2.5.1 wxWidgets - DOC "wxWidgets base/installation directory?" + DOC "wxWidgets base/installation directory" ) # If wxWidgets_ROOT_DIR changed, clear lib dir. @@ -492,7 +492,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") PATHS ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll # prefer shared ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib - DOC "Path to wxWidgets libraries?" + DOC "Path to wxWidgets libraries" NO_DEFAULT_PATH ) else() @@ -509,7 +509,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") PATHS ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib # prefer static ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll - DOC "Path to wxWidgets libraries?" + DOC "Path to wxWidgets libraries" NO_DEFAULT_PATH ) endif() @@ -703,6 +703,7 @@ else() #----------------------------------------------------------------- # Support cross-compiling, only search in the target platform. find_program(wxWidgets_CONFIG_EXECUTABLE wx-config + DOC "Location of wxWidgets library configuration provider binary (wx-config)." ONLY_CMAKE_FIND_ROOT_PATH ) @@ -843,6 +844,7 @@ set(wxWidgets_FOUND ${WXWIDGETS_FOUND}) # Resource file compiler. find_program(wxWidgets_wxrc_EXECUTABLE wxrc ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw + DOC "Location of wxWidgets resource file compiler binary (wxrc)" ) # diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 4179f7b..868d20c 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -321,7 +321,7 @@ if(WIN32_STYLE_FIND) rpcrt4 wsock32 ) - ## HACK: feed in to optimized / debug libaries if both were FOUND. + ## HACK: feed in to optimized / debug libraries if both were FOUND. set(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS} wxbase26d wxbase26d_net @@ -354,7 +354,7 @@ if(WIN32_STYLE_FIND) ## ## if there is at least one shared lib available - ## let user choose wether to use shared or static wxwindows libs + ## let user choose whether to use shared or static wxwindows libs if(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) ## default value OFF because wxWindows MSVS default build is static option(WXWINDOWS_USE_SHARED_LIBS @@ -606,7 +606,7 @@ else() ../wx/bin ../../wx/bin ) - # check wether wx-config was found: + # check whether wx-config was found: if(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) # use shared/static wx lib? diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 892ebc6..4ef14ac 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -267,6 +267,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) if(_GEH_EXPORT_MACRO_NAME) set(EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME}) endif() + string(MAKE_C_IDENTIFIER ${EXPORT_MACRO_NAME} EXPORT_MACRO_NAME) if(_GEH_EXPORT_FILE_NAME) if(IS_ABSOLUTE ${_GEH_EXPORT_FILE_NAME}) set(EXPORT_FILE_NAME ${_GEH_EXPORT_FILE_NAME}) @@ -277,12 +278,15 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) if(_GEH_DEPRECATED_MACRO_NAME) set(DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_DEPRECATED_MACRO_NAME}) endif() + string(MAKE_C_IDENTIFIER ${DEPRECATED_MACRO_NAME} DEPRECATED_MACRO_NAME) if(_GEH_NO_EXPORT_MACRO_NAME) set(NO_EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_EXPORT_MACRO_NAME}) endif() + string(MAKE_C_IDENTIFIER ${NO_EXPORT_MACRO_NAME} NO_EXPORT_MACRO_NAME) if(_GEH_STATIC_DEFINE) set(STATIC_DEFINE ${_GEH_PREFIX_NAME}${_GEH_STATIC_DEFINE}) endif() + string(MAKE_C_IDENTIFIER ${STATIC_DEFINE} STATIC_DEFINE) if(_GEH_DEFINE_NO_DEPRECATED) set(DEFINE_NO_DEPRECATED TRUE) @@ -292,6 +296,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) set(NO_DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_DEPRECATED_MACRO_NAME}) endif() + string(MAKE_C_IDENTIFIER ${NO_DEPRECATED_MACRO_NAME} NO_DEPRECATED_MACRO_NAME) set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H") @@ -300,6 +305,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) if(NOT EXPORT_IMPORT_CONDITION) set(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY}_EXPORTS) endif() + string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION) configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in" "${EXPORT_FILE_NAME}" @ONLY) @@ -307,11 +313,9 @@ endmacro() function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) - if(${type} STREQUAL "MODULE") - message(WARNING "This macro should not be used with libraries of type MODULE") - return() - endif() - if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL "SHARED_LIBRARY") + if(NOT ${type} STREQUAL "STATIC_LIBRARY" + AND NOT ${type} STREQUAL "SHARED_LIBRARY" + AND NOT ${type} STREQUAL "MODULE_LIBRARY") message(WARNING "This macro can only be used with libraries") return() endif() diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 59a444b..76310af 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -916,7 +916,9 @@ Function .onInit ;Run the uninstaller uninst: ClearErrors - ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file + StrLen $2 "\Uninstall.exe" + StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path + ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file IfErrors uninst_failed inst uninst_failed: diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 2e6b71e..f0652b9 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -30,6 +30,11 @@ set(CMAKE_SHARED_MODULE_SUFFIX ".so") set(CMAKE_MODULE_EXISTS 1) set(CMAKE_DL_LIBS "") +# Enable rpath support for 10.5 and greater where it is known to work. +if("${DARWIN_MAJOR_VERSION}" GREATER 8) + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +endif() + set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") @@ -207,12 +212,8 @@ if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") endif() -if(NOT XCODE) - # Enable shared library versioning. This flag is not actually referenced - # but the fact that the setting exists will cause the generators to support - # soname computation. - set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") -endif() +# Enable shared library versioning. +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") # Xcode does not support -isystem yet. if(XCODE) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 2598411..315f721 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -13,6 +13,9 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +# http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples +set(CMAKE_C_COMPILE_OPTION_TARGET "-V") +set(CMAKE_CXX_COMPILE_OPTION_TARGET "-V") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 307230e..26b3c0c 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -78,23 +78,24 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R macro(__embarcadero_language lang) set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # ... while this is a space separated string. + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) # compile a source file into an object file # place <DEFINES> outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${_tR} <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}" + "<CMAKE_${lang}_COMPILER> ${_tR} <DEFINES> -DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>" ) set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> ${_tR} -e<TARGET> ${CMAKE_START_TEMP_FILE}<LINK_FLAGS> <FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + "<CMAKE_${lang}_COMPILER> ${_tR} -e<TARGET> <LINK_FLAGS> <FLAGS> ${CMAKE_START_TEMP_FILE} <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" # "implib -c -w <TARGET_IMPLIB> <TARGET>" ) # place <DEFINES> outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}" + "cpp32 <DEFINES> -DWIN32 <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>" ) # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 8a9d630..69a7f2f 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -81,7 +81,7 @@ endif() macro(__windows_compiler_intel lang) set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> /Fd<OBJECT_DIR>/ <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) @@ -91,7 +91,7 @@ macro(__windows_compiler_intel lang) set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e03b601..9f97570 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -22,7 +22,7 @@ set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") set(CMAKE_LINK_LIBRARY_FLAG "") set(MSVC 1) -# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree +# hack: if a new cmake (which uses CMAKE_LINKER) runs on an old build tree # (where link was hardcoded) and where CMAKE_LINKER isn't in the cache # and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) # hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex @@ -52,9 +52,6 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio 6") endif() if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") set (CMAKE_NO_BUILD_TYPE 1) - set (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING - "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") - mark_as_advanced(CMAKE_CONFIGURATION_TYPES) endif() # make sure to enable languages after setting configuration types @@ -231,7 +228,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/ -c <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE @@ -240,7 +237,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE - "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> <OBJECTS> /link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index 7e2ac9f..8dfb610 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -38,8 +38,6 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio 6") endif() if(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") set (CMAKE_NO_BUILD_TYPE 1) - set (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING - "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") endif() # does the compiler support pdbtype and is it the newer compiler diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index bd31da0..fc921d7 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -77,10 +77,12 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") list(APPEND CMAKE_SYSTEM_PREFIX_PATH # Project install destination. "${CMAKE_INSTALL_PREFIX}" + ) +if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set) - / - ) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH /) +endif() list(APPEND CMAKE_SYSTEM_INCLUDE_PATH ) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 251d57c..a0b2e31 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -21,15 +21,20 @@ ###################################### -macro (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options) +macro (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options _qt4_target) set(${_qt4_files}) set(${_qt4_options}) set(_QT4_DOING_OPTIONS FALSE) + set(_QT4_DOING_TARGET FALSE) foreach(_currentArg ${ARGN}) - if ("${_currentArg}" STREQUAL "OPTIONS") + if ("x${_currentArg}" STREQUAL "xOPTIONS") set(_QT4_DOING_OPTIONS TRUE) + elseif ("x${_currentArg}" STREQUAL "xTARGET") + set(_QT4_DOING_TARGET TRUE) else () - if(_QT4_DOING_OPTIONS) + if(_QT4_DOING_TARGET) + set(${_qt4_target} "${_currentArg}") + elseif(_QT4_DOING_OPTIONS) list(APPEND ${_qt4_options} "${_currentArg}") else() list(APPEND ${_qt4_files} "${_currentArg}") @@ -92,34 +97,49 @@ endmacro() # helper macro to set up a moc rule -macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) +macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) # For Windows, create a parameters file to work around command line length limit - if (WIN32) - # Pass the parameters in a file. Set the working directory to - # be that containing the parameters file and reference it by - # just the file name. This is necessary because the moc tool on - # MinGW builds does not seem to handle spaces in the path to the - # file given with the @ syntax. - get_filename_component(_moc_outfile_name "${outfile}" NAME) - get_filename_component(_moc_outfile_dir "${outfile}" PATH) - if(_moc_outfile_dir) - set(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) - endif() - set (_moc_parameters_file ${outfile}_parameters) - set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") - string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") - file (WRITE ${_moc_parameters_file} "${_moc_parameters}") - add_custom_command(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters - DEPENDS ${infile} - ${_moc_working_dir} - VERBATIM) - else () - add_custom_command(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} - DEPENDS ${infile} VERBATIM) - endif () + # Pass the parameters in a file. Set the working directory to + # be that containing the parameters file and reference it by + # just the file name. This is necessary because the moc tool on + # MinGW builds does not seem to handle spaces in the path to the + # file given with the @ syntax. + get_filename_component(_moc_outfile_name "${outfile}" NAME) + get_filename_component(_moc_outfile_dir "${outfile}" PATH) + if(_moc_outfile_dir) + set(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) + endif() + set (_moc_parameters_file ${outfile}_parameters) + set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") + string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") + + set(targetincludes) + set(targetdefines) + if(moc_target) + list(APPEND targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>") + list(APPEND targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>") + + set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:${targetincludes},\n-I>\n>") + set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:${targetdefines},\n-D>\n>") + + file (GENERATE + OUTPUT ${_moc_parameters_file} + CONTENT "${targetdefines}${targetincludes}${targetoptions}${_moc_parameters}\n" + CONDITION 1 + ) + + set(targetincludes) + set(targetdefines) + else() + file(WRITE ${_moc_parameters_file} "${_moc_parameters}\n") + endif() + + set(_moc_extra_parameters_file @${_moc_parameters_file}) + add_custom_command(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} ${_moc_extra_parameters_file} + DEPENDS ${infile} + ${_moc_working_dir} + VERBATIM) endmacro () @@ -131,7 +151,11 @@ macro (QT4_GENERATE_MOC infile outfile ) if(NOT IS_ABSOLUTE "${outfile}") set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") endif() - QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "") + + if ("x${ARGV2}" STREQUAL "xTARGET") + set(moc_target ${ARGV3}) + endif() + QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file endmacro () @@ -141,12 +165,12 @@ endmacro () macro (QT4_WRAP_CPP outfiles ) # get include dirs QT4_GET_MOC_FLAGS(moc_flags) - QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN}) + QT4_EXTRACT_OPTIONS(moc_files moc_options moc_target ${ARGN}) foreach (it ${moc_files}) get_filename_component(it ${it} ABSOLUTE) QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) - QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}") + QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}") set(${outfiles} ${${outfiles}} ${outfile}) endforeach() @@ -156,7 +180,7 @@ endmacro () # QT4_WRAP_UI(outfiles inputfile ... ) macro (QT4_WRAP_UI outfiles ) - QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN}) + QT4_EXTRACT_OPTIONS(ui_files ui_options ui_target ${ARGN}) foreach (it ${ui_files}) get_filename_component(outfile ${it} NAME_WE) @@ -175,7 +199,7 @@ endmacro () # QT4_ADD_RESOURCES(outfiles inputfile ... ) macro (QT4_ADD_RESOURCES outfiles ) - QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN}) + QT4_EXTRACT_OPTIONS(rcc_files rcc_options rcc_target ${ARGN}) foreach (it ${rcc_files}) get_filename_component(outfilename ${it} NAME_WE) @@ -270,7 +294,7 @@ endmacro() macro(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) - QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN}) + QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options _qt4_dbus_target ${ARGN}) get_filename_component(_in_file ${_header} ABSOLUTE) get_filename_component(_basename ${_header} NAME_WE) @@ -366,7 +390,7 @@ macro(QT4_AUTOMOC) set(_header ${_abs_PATH}/${_basename}.h) endif() set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) - QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") + QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "" "") MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) endforeach () endif() @@ -376,7 +400,7 @@ endmacro() macro(QT4_CREATE_TRANSLATION _qm_files) - QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN}) + QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options _lupdate_target ${ARGN}) set(_my_sources) set(_my_dirs) set(_my_tsfiles) @@ -451,14 +475,22 @@ function(qt4_use_modules _target _link_type) endif() foreach(_module ${modules}) string(TOUPPER ${_module} _ucmodule) - if (NOT QT_QT${_ucmodule}_FOUND) - message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") - endif() - if ("${_ucmodule}" STREQUAL "MAIN") - message(FATAL_ERROR "Can not use \"${_module}\" module with qt4_use_modules.") + set(_targetPrefix QT_QT${_ucmodule}) + if (_ucmodule STREQUAL QAXCONTAINER OR _ucmodule STREQUAL QAXSERVER) + if (NOT QT_Q${_ucmodule}_FOUND) + message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") + endif() + set(_targetPrefix QT_Q${_ucmodule}) + else() + if (NOT QT_QT${_ucmodule}_FOUND) + message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") + endif() + if ("${_ucmodule}" STREQUAL "MAIN") + message(FATAL_ERROR "Can not use \"${_module}\" module with qt4_use_modules.") + endif() endif() - target_link_libraries(${_target} ${link_type} ${QT_QT${_ucmodule}_LIBRARY}) - set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${QT_QT${_ucmodule}_INCLUDE_DIR} ${QT_HEADERS_DIR} ${QT_MKSPECS_DIR}/default) - set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${QT_QT${_ucmodule}_COMPILE_DEFINITIONS}) + target_link_libraries(${_target} ${link_type} ${${_targetPrefix}_LIBRARIES}) + set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${${_targetPrefix}_INCLUDE_DIR} ${QT_HEADERS_DIR} ${QT_MKSPECS_DIR}/default) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${${_targetPrefix}_COMPILE_DEFINITIONS}) endforeach() endfunction() diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index 62137bb..5bca064 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -62,7 +62,7 @@ macro( select_library_configurations basename ) # 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 ) - set( ${basename}_LIBRARY ) + set( ${basename}_LIBRARY "" ) foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) endforeach() diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 028df82..0c4fee4 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -132,10 +132,10 @@ macro(ECOS_ADJUST_DIRECTORY _target_FILES ) endmacro() # the default ecos config file name -# maybe in the future also out-of-source builds may be possible +# maybe in future also out-of-source builds may be possible set(ECOS_CONFIG_FILE ecos.ecc) -#creates the dependancy from all source files on the ecos target.ld, +#creates the dependency from all source files on the ecos target.ld, #adds the command for compiling ecos macro(ECOS_ADD_TARGET_LIB) # when building out-of-source, create the ecos/ subdir diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 0438695..0242b24 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -6,6 +6,10 @@ # add_jar(target_name # [SOURCES] source1 [source2 ...] [resource1 ...] # [INCLUDE_JARS jar1 [jar2 ...]] +# [ENTRY_POINT entry] +# [VERSION version] +# [OUTPUT_NAME name] +# [OUTPUT_DIR dir] # ) # # This command creates a <target_name>.jar. It compiles the given source files @@ -17,6 +21,9 @@ # listed as sources are ignored (as they have been since the first version of # this module). # +# The default OUTPUT_DIR can also be changed by setting the variable +# CMAKE_JAVA_TARGET_OUTPUT_DIR. +# # Additional instructions: # To add compile flags to the target you can set these flags with # the following variable: @@ -30,32 +37,30 @@ # # To use a different output name for the target you can set it with: # -# set(CMAKE_JAVA_TARGET_OUTPUT_NAME shibboleet.jar) -# add_jar(foobar foobar.java) +# add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar) # # 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) +# add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) # -# To define an entry point in your jar you can set it with: +# To define an entry point in your jar you can set it with the ENTRY_POINT +# named argument: # -# set(CMAKE_JAVA_JAR_ENTRY_POINT com/examples/MyProject/Main) +# add_jar(example 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 +# 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 # pointing to the jar with the version information. # -# set(CMAKE_JAVA_TARGET_VERSION 1.2.0) -# add_jar(shibboleet shibbotleet.java) +# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) # # If the target is a JNI library, utilize the following commands to # create a JNI symbolic link: # # set(CMAKE_JNI_TARGET TRUE) -# set(CMAKE_JAVA_TARGET_VERSION 1.2.0) -# add_jar(shibboleet shibbotleet.java) +# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) # install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) # install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) # @@ -216,23 +221,50 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) function(add_jar _TARGET_NAME) - cmake_parse_arguments(_add_jar "" "" "SOURCES;INCLUDE_JARS" ${ARGN}) + # In CMake < 2.8.12, add_jar used variables which were set prior to calling + # add_jar for customizing the behavior of add_jar. In order to be backwards + # compatible, check if any of those variables are set, and use them to + # initialize values of the named arguments. (Giving the corresponding named + # argument will override the value set here.) + # + # New features should use named arguments only. + if(DEFINED CMAKE_JAVA_TARGET_VERSION) + set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}") + endif() + if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}") + endif() + if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) + set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}") + # reset + set(CMAKE_JAVA_TARGET_OUTPUT_NAME) + endif() + if(DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) + set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}") + endif() + + cmake_parse_arguments(_add_jar + "" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT" + "SOURCES;INCLUDE_JARS" + ${ARGN} + ) set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS}) - if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) - set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + if (NOT DEFINED _add_jar_OUTPUT_DIR) + set(_add_jar_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() - if (CMAKE_JAVA_JAR_ENTRY_POINT) - set(_ENTRY_POINT_OPTION e) - set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT}) + if (_add_jar_ENTRY_POINT) + set(_ENTRY_POINT_OPTION e) + set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT}) endif () if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) else () - set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR}) + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${_add_jar_OUTPUT_DIR}) endif () set(CMAKE_JAVA_INCLUDE_PATH @@ -242,7 +274,7 @@ function(add_jar _TARGET_NAME) ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} ) - if (WIN32 AND NOT CYGWIN) + if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") @@ -252,20 +284,18 @@ 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() - set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_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) - set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") - set(_JAVA_TARGET_OUTPUT_LINK "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") - elseif (CMAKE_JAVA_TARGET_VERSION) - set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") + if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}-${_add_jar_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${_add_jar_OUTPUT_NAME}.jar") + elseif (_add_jar_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${_add_jar_VERSION}.jar") set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") - elseif (CMAKE_JAVA_TARGET_OUTPUT_NAME) - set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") + elseif (_add_jar_OUTPUT_NAME) + set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}.jar") endif () - # reset - set(CMAKE_JAVA_TARGET_OUTPUT_NAME) set(_JAVA_CLASS_FILES) set(_JAVA_COMPILE_FILES) @@ -279,7 +309,7 @@ function(add_jar _TARGET_NAME) get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) if (_JAVA_EXT MATCHES ".java") - file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_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) @@ -364,7 +394,7 @@ function(add_jar _TARGET_NAME) # create the jar file set(_JAVA_JAR_OUTPUT_PATH - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) if (CMAKE_JNI_TARGET) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} @@ -372,12 +402,12 @@ function(add_jar _TARGET_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_JAVA_TARGET_OUTPUT_DIR} + -D_JAVA_TARGET_DIR=${_add_jar_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_JAVA_TARGET_OUTPUT_DIR} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} @@ -392,7 +422,7 @@ function(add_jar _TARGET_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_JAVA_TARGET_OUTPUT_DIR} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} @@ -420,7 +450,7 @@ function(add_jar _TARGET_NAME) PROPERTY INSTALL_FILES ${_JAVA_JAR_OUTPUT_PATH} - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} ) if (CMAKE_JNI_TARGET) @@ -429,7 +459,7 @@ function(add_jar _TARGET_NAME) ${_TARGET_NAME} PROPERTY JNI_SYMLINK - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} ) endif () endif () |