diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFortranCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CPackRPM.cmake | 73 | ||||
-rw-r--r-- | Modules/Compiler/Cray-DetermineCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/GNU-DetermineCompiler.cmake | 4 | ||||
-rw-r--r-- | Modules/DartConfiguration.tcl.in | 1 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 8 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 6 | ||||
-rw-r--r-- | Modules/FindJava.cmake | 94 | ||||
-rw-r--r-- | Modules/FindMPI.cmake | 8 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 142 | ||||
-rw-r--r-- | Modules/FindPkgConfig.cmake | 12 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 17 | ||||
-rw-r--r-- | Modules/FindTIFF.cmake | 14 | ||||
-rw-r--r-- | Modules/FindXercesC.cmake | 16 | ||||
-rw-r--r-- | Modules/GetPrerequisites.cmake | 38 | ||||
-rw-r--r-- | Modules/Platform/ARTOS-GNU-C.cmake | 9 | ||||
-rw-r--r-- | Modules/Platform/ARTOS.cmake | 17 | ||||
-rw-r--r-- | Modules/Platform/HP-UX.cmake | 17 | ||||
-rw-r--r-- | Modules/Platform/SunOS.cmake | 8 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 88 |
20 files changed, 454 insertions, 121 deletions
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index e4c7618..14fdd60 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -1,6 +1,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") +set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index cb77fb8..7c1db14 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -95,6 +95,7 @@ # * Default : CPACK_PACKAGE_VENDOR if set or "unknown" # # .. variable:: CPACK_RPM_PACKAGE_URL +# CPACK_RPM_<component>_PACKAGE_URL # # The projects URL. # @@ -123,7 +124,55 @@ # compression whereas older cannot use such RPM. Using this one can enforce # compression type to be used. Possible value are: lzma, xz, bzip2 and gzip. # +# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ +# CPACK_RPM_<component>_PACKAGE_AUTOREQ +# +# RPM spec autoreq field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to enable (1, yes) or disable (0, no) automatic shared libraries +# dependency detection. Dependencies are added to requires list. +# +# .. note:: +# +# By defalut automatic dependency detection is enabled by rpm generator. +# +# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV +# CPACK_RPM_<component>_PACKAGE_AUTOPROV +# +# RPM spec autoprov field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to enable (1, yes) or disable (0, no) automatic listing of shared +# libraries that are provided by the package. Shared libraries are added to +# provides list. +# +# .. note:: +# +# By defalut automatic provides detection is enabled by rpm generator. +# +# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV +# CPACK_RPM_<component>_PACKAGE_AUTOREQPROV +# +# RPM spec autoreqprov field. +# +# * Mandatory : NO +# * Default : - +# +# Variable enables/disables autoreq and autoprov at the same time. +# See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV` +# for more details. +# +# .. note:: +# +# By defalut automatic detection feature is enabled by rpm. +# # .. variable:: CPACK_RPM_PACKAGE_REQUIRES +# CPACK_RPM_<component>_PACKAGE_REQUIRES # # RPM spec requires field. # @@ -139,7 +188,25 @@ # # rpm -qp --requires file.rpm # +# .. variable:: CPACK_RPM_PACKAGE_CONFLICTS +# CPACK_RPM_<component>_PACKAGE_CONFLICTS +# +# RPM spec conflicts field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to set negative RPM dependencies (conflicts). Note that you must enclose +# the complete requires string between quotes, for example:: +# +# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2") +# +# The conflicting package list of an RPM file could be printed with:: +# +# rpm -qp --conflicts file.rpm +# # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE +# CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE # # RPM spec requires(pre) field. # @@ -152,6 +219,7 @@ # set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts") # # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST +# CPACK_RPM_<component>_PACKAGE_REQUIRES_POST # # RPM spec requires(post) field. # @@ -165,6 +233,7 @@ # # # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN +# CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN # # RPM spec requires(postun) field. # @@ -178,6 +247,7 @@ # # # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN +# CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN # # RPM spec requires(preun) field. # @@ -190,6 +260,7 @@ # set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts") # # .. variable:: CPACK_RPM_PACKAGE_SUGGESTS +# CPACK_RPM_<component>_PACKAGE_SUGGESTS # # RPM spec suggest field. # @@ -200,6 +271,7 @@ # enclose the complete requires string between quotes. # # .. variable:: CPACK_RPM_PACKAGE_PROVIDES +# CPACK_RPM_<component>_PACKAGE_PROVIDES # # RPM spec provides field. # @@ -212,6 +284,7 @@ # rpm -qp --provides file.rpm # # .. variable:: CPACK_RPM_PACKAGE_OBSOLETES +# CPACK_RPM_<component>_PACKAGE_OBSOLETES # # RPM spec obsoletes field. # diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake index 881b82c..6602294 100644 --- a/Modules/Compiler/Cray-DetermineCompiler.cmake +++ b/Modules/Compiler/Cray-DetermineCompiler.cmake @@ -2,5 +2,5 @@ set(_compiler_id_pp_test "defined(_CRAYC)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE_MAJOR) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)") diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake index 261f148..6ddc566 100644 --- a/Modules/Compiler/GNU-DetermineCompiler.cmake +++ b/Modules/Compiler/GNU-DetermineCompiler.cmake @@ -3,7 +3,9 @@ set(_compiler_id_pp_test "defined(__GNUC__)") set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# if defined(__GNUC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# endif # if defined(__GNUC_PATCHLEVEL__) # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) # endif") diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 918b407..2da8354 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -69,6 +69,7 @@ UpdateType: @UPDATE_TYPE@ # Compiler info Compiler: @CMAKE_CXX_COMPILER@ +CompilerVersion: @CMAKE_CXX_COMPILER_VERSION@ # Dynamic analysis (MemCheck) PurifyCommand: @PURIFYCOMMAND@ diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index f6844be..0fbf7c3 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -609,7 +609,7 @@ if(error_code) endif() execute_process( - COMMAND \"${hg_EXECUTABLE}\" clone \"${hg_repository}\" \"${src_name}\" + COMMAND \"${hg_EXECUTABLE}\" clone -U \"${hg_repository}\" \"${src_name}\" WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -1211,7 +1211,7 @@ function(_ep_get_build_command name step cmd_var) if(step STREQUAL "INSTALL") set(args install) endif() - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") set(args test) endif() else() @@ -1230,7 +1230,7 @@ function(_ep_get_build_command name step cmd_var) list(APPEND args --target install) endif() # But for "TEST" drive the project with corresponding "ctest". - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") endif() @@ -1246,7 +1246,7 @@ function(_ep_get_build_command name step cmd_var) if(step STREQUAL "INSTALL") set(args install) endif() - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") set(args test) endif() endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 05b552a..33e6a49 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -512,13 +512,15 @@ else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" - "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" + + "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" + "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33") + set(_boost_TEST_VERSIONS) if(Boost_FIND_VERSION) set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9e43174..9f87997 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -8,21 +8,34 @@ # include files and libraries are. The caller may set variable JAVA_HOME # to specify a Java installation prefix explicitly. # +# +# Specify one or more of the following components as you call this find module. See example below. +# +# :: +# +# Runtime = User just want to execute some Java byte-compiled +# Development = Development tools (java, javac, javah and javadoc), includes Runtime component +# IdlJ = idl compiler for Java +# JarSigner = signer tool for jar +# +# # This module sets the following result variables: # # :: # -# Java_JAVA_EXECUTABLE = the full path to the Java runtime -# Java_JAVAC_EXECUTABLE = the full path to the Java compiler -# Java_JAVAH_EXECUTABLE = the full path to the Java header generator -# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator -# Java_JAR_EXECUTABLE = the full path to the Java archiver -# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12 -# Java_VERSION_MAJOR = The major version of the package found. -# Java_VERSION_MINOR = The minor version of the package found. -# Java_VERSION_PATCH = The patch version of the package found. -# Java_VERSION_TWEAK = The tweak version of the package found (after '_') -# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) +# Java_JAVA_EXECUTABLE = the full path to the Java runtime +# Java_JAVAC_EXECUTABLE = the full path to the Java compiler +# Java_JAVAH_EXECUTABLE = the full path to the Java header generator +# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator +# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler +# Java_JAR_EXECUTABLE = the full path to the Java archiver +# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer +# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12 +# Java_VERSION_MAJOR = The major version of the package found. +# Java_VERSION_MINOR = The minor version of the package found. +# Java_VERSION_PATCH = The patch version of the package found. +# Java_VERSION_TWEAK = The tweak version of the package found (after '_') +# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) # # # @@ -184,28 +197,61 @@ find_program(Java_JAVADOC_EXECUTABLE PATHS ${_JAVA_PATHS} ) +find_program(Java_IDLJ_EXECUTABLE + NAMES idlj + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} +) + +find_program(Java_JARSIGNER_EXECUTABLE + NAMES jarsigner + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} +) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) if(Java_FIND_COMPONENTS) + set(_JAVA_REQUIRED_VARS) foreach(component ${Java_FIND_COMPONENTS}) # User just want to execute some Java byte-compiled - if(component STREQUAL "Runtime") - find_package_handle_standard_args(Java - REQUIRED_VARS Java_JAVA_EXECUTABLE - VERSION_VAR Java_VERSION - ) + If(component STREQUAL "Runtime") + list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE) + if(Java_JAVA_EXECUTABLE) + set(Java_Runtime_FOUND TRUE) + endif() elseif(component STREQUAL "Development") - find_package_handle_standard_args(Java - REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE - Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE - VERSION_VAR Java_VERSION - ) + list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAVAC_EXECUTABLE + Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) + if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE + AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE) + set(Java_Development_FOUND TRUE) + endif() + elseif(component STREQUAL "IdlJ") + list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE) + if(Java_IdlJ_EXECUTABLE) + set(Java_Extra_FOUND TRUE) + endif() + elseif(component STREQUAL "JarSigner") + list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE) + if(Java_IDLJ_EXECUTABLE) + set(Java_JarSigner_FOUND TRUE) + endif() else() message(FATAL_ERROR "Comp: ${component} is not handled") endif() - set(Java_${component}_FOUND TRUE) endforeach() + list (REMOVE_DUPLICATES _JAVA_REQUIRED_VARS) + find_package_handle_standard_args(Java + REQUIRED_VARS ${_JAVA_REQUIRED_VARS} HANDLE_COMPONENTS + VERSION_VAR Java_VERSION + ) + if(Java_FOUND) + foreach(component ${Java_FIND_COMPONENTS}) + set(Java_${component}_FOUND TRUE) + endforeach() + endif() else() - # Check for everything + # Check for Development find_package_handle_standard_args(Java REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE @@ -220,6 +266,8 @@ mark_as_advanced( Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE + Java_IDLJ_EXECUTABLE + Java_JARSIGNER_EXECUTABLE ) # LEGACY diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 06ecfaa..48adf3c 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -102,7 +102,6 @@ # include this to handle the QUIETLY and REQUIRED arguments include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake) # # This part detects MPI compilers, attempting to wade through the mess of compiler names in @@ -578,14 +577,13 @@ foreach (lang C CXX Fortran) if (CMAKE_${lang}_COMPILER_WORKS) # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. if (MPI_${lang}_COMPILER) - is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE) - if (NOT MPI_COMPILER_IS_EXECUTABLE) + if (NOT IS_ABSOLUTE "${MPI_${lang}_COMPILER}") # Get rid of our default list of names and just search for the name the user wants. set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER}) set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - # If the user specifies a compiler, we don't want to try to search libraries either. - set(try_libs FALSE) endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(try_libs FALSE) else() set(try_libs TRUE) endif() diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 3adc269..434ef58 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -2,26 +2,40 @@ # FindOpenSSL # ----------- # -# Try to find the OpenSSL encryption library +# Find the OpenSSL encryption library. # -# Once done this will define +# Imported Targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL +# ``OpenSSL::SSL`` +# The OpenSSL ``ssl`` library, if found. +# ``OpenSSL::Crypto`` +# The OpenSSL ``crypto`` library, if found. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module will set the following variables in your project: # -# Read-Only variables: +# ``OPENSSL_FOUND`` +# System has the OpenSSL library. +# ``OPENSSL_INCLUDE_DIR`` +# The OpenSSL include directory. +# ``OPENSSL_CRYPTO_LIBRARY`` +# The OpenSSL crypto library. +# ``OPENSSL_SSL_LIBRARY`` +# The OpenSSL SSL library. +# ``OPENSSL_LIBRARIES`` +# All OpenSSL libraries. +# ``OPENSSL_VERSION`` +# This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``). # -# :: +# Hints +# ^^^^^ # -# OPENSSL_FOUND - System has the OpenSSL library -# OPENSSL_INCLUDE_DIR - The OpenSSL include directory -# OPENSSL_CRYPTO_LIBRARY - The OpenSSL crypto library -# OPENSSL_SSL_LIBRARY - The OpenSSL SSL library -# OPENSSL_LIBRARIES - All OpenSSL libraries -# OPENSSL_VERSION - This is set to $major.$minor.$revision$patch (eg. 0.9.8s) +# Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -99,15 +113,20 @@ if(WIN32 AND NOT CYGWIN) # We are using the libraries located in the VC subdir instead of the parent directory eventhough : # libeay32MD.lib is identical to ../libeay32.lib, and # ssleay32MD.lib is identical to ../ssleay32.lib + + set(_OPENSSL_PATH_SUFFIXES + "lib" + "VC" + "lib/VC" + ) + find_library(LIB_EAY_DEBUG NAMES libeay32MDd libeay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) find_library(LIB_EAY_RELEASE @@ -116,9 +135,7 @@ if(WIN32 AND NOT CYGWIN) libeay32 ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) find_library(SSL_EAY_DEBUG @@ -127,9 +144,7 @@ if(WIN32 AND NOT CYGWIN) ssleay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) find_library(SSL_EAY_RELEASE @@ -139,9 +154,7 @@ if(WIN32 AND NOT CYGWIN) ssl ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") @@ -155,9 +168,9 @@ if(WIN32 AND NOT CYGWIN) mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) - set( OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} ) - set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} ) - set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) + set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} ) + set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} ) + set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW set(LIB_EAY_NAMES libeay32) @@ -185,9 +198,9 @@ if(WIN32 AND NOT CYGWIN) ) mark_as_advanced(SSL_EAY LIB_EAY) - set( OPENSSL_SSL_LIBRARY ${SSL_EAY} ) - set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) - set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) + set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) + set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) unset(LIB_EAY_NAMES) unset(SSL_EAY_NAMES) else() @@ -213,9 +226,9 @@ if(WIN32 AND NOT CYGWIN) ) mark_as_advanced(SSL_EAY LIB_EAY) - set( OPENSSL_SSL_LIBRARY ${SSL_EAY} ) - set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) - set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) + set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) + set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) endif() else() @@ -338,3 +351,66 @@ else () endif () mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) + +if(OPENSSL_FOUND) + if(NOT TARGET OpenSSL::Crypto AND + (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR + EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR + EXISTS "${LIB_EAY_LIBRARY_RELEASE}") + ) + add_library(OpenSSL::Crypto UNKNOWN IMPORTED) + set_target_properties(OpenSSL::Crypto PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") + if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}") + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}") + endif() + if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}") + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}") + endif() + if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}") + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}") + endif() + endif() + if(NOT TARGET OpenSSL::SSL AND + (EXISTS "${OPENSSL_SSL_LIBRARY}" OR + EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR + EXISTS "${SSL_EAY_LIBRARY_RELEASE}") + ) + add_library(OpenSSL::SSL UNKNOWN IMPORTED) + set_target_properties(OpenSSL::SSL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") + if(EXISTS "${OPENSSL_SSL_LIBRARY}") + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}") + endif() + if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}") + set_property(TARGET OpenSSL::SSL APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}") + endif() + if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}") + set_property(TARGET OpenSSL::SSL APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}") + endif() + if(TARGET OpenSSL::Crypto) + set_target_properties(OpenSSL::SSL PROPERTIES + INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) + endif() + endif() +endif() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 53c17f1..ae6903e 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -109,7 +109,7 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cma set(${_no_cmake_path} 1) set(${_no_cmake_environment_path} 1) endif() - elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1) + elseif(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1) set(${_no_cmake_path} 1) set(${_no_cmake_environment_path} 1) endif() @@ -192,9 +192,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma # give out status message telling checked module if (NOT ${_is_silent}) if (_pkg_check_modules_cnt EQUAL 1) - message(STATUS "checking for module '${_pkg_check_modules_list}'") + message(STATUS "Checking for module '${_pkg_check_modules_list}'") else() - message(STATUS "checking for modules '${_pkg_check_modules_list}'") + message(STATUS "Checking for modules '${_pkg_check_modules_list}'") endif() endif() @@ -327,7 +327,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma # evaluate result and tell failures if (_pkgconfig_retval) if(NOT ${_is_silent}) - message(STATUS " package '${_pkg_check_modules_pkg}' not found") + message(STATUS " Package '${_pkg_check_modules_pkg}' not found") endif() set(_pkg_check_modules_failed 1) @@ -361,7 +361,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) if (NOT ${_is_silent}) - message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") + message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") endif () endforeach() @@ -529,7 +529,7 @@ macro(pkg_search_module _prefix _module0) _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN}) if (NOT ${_pkg_is_silent}) - message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") + message(STATUS "Checking for one of the modules '${_pkg_modules_alt}'") endif () # iterate through all modules and stop at the first working one. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index f01bd41..335c408 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -9,8 +9,9 @@ # ``PROTOBUF_SRC_ROOT_FOLDER`` # When compiling with MSVC, if this cache variable is set # the protobuf-default VS project build locations -# (vsprojects/Debug & vsprojects/Release) will be searched -# for libraries and binaries. +# (vsprojects/Debug and vsprojects/Release +# or vsprojects/x64/Debug and vsprojects/x64/Release) +# will be searched for libraries and binaries. # ``PROTOBUF_IMPORT_DIRS`` # List of additional directories to be searched for # imported .proto files. @@ -146,18 +147,22 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(${HDRS} ${${HDRS}} PARENT_SCOPE) endfunction() +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_PROTOBUF_ARCH_DIR x64/) +endif() + # Internal function: search for normal library as well as a debug one # if the debug one is specified also include debug/optimized keywords # in *_LIBRARIES variable function(_protobuf_find_libraries name filename) find_library(${name}_LIBRARY NAMES ${filename} - PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release) + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release) mark_as_advanced(${name}_LIBRARY) find_library(${name}_LIBRARY_DEBUG NAMES ${filename} - PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug) + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug) mark_as_advanced(${name}_LIBRARY_DEBUG) if(NOT ${name}_LIBRARY_DEBUG) @@ -234,8 +239,8 @@ find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc DOC "The Google Protocol Buffers Compiler" PATHS - ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release - ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug ) mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index a67d24d..ed092ea 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -34,7 +34,19 @@ find_path(TIFF_INCLUDE_DIR tiff.h) set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) -find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) +foreach(name ${TIFF_NAMES}) + list(APPEND TIFF_NAMES_DEBUG "${name}d") +endforeach() + +if(NOT TIFF_LIBRARY) + find_library(TIFF_LIBRARY_RELEASE NAMES ${TIFF_NAMES}) + find_library(TIFF_LIBRARY_DEBUG NAMES ${TIFF_NAMES_DEBUG}) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(TIFF) + mark_as_advanced(TIFF_LIBRARY_RELEASE TIFF_LIBRARY_DEBUG) +endif() +unset(TIFF_NAMES) +unset(TIFF_NAMES_DEBUG) if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index fd0b992..cf84826 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -61,10 +61,18 @@ find_path(XercesC_INCLUDE_DIR DOC "Xerces-C++ include directory") mark_as_advanced(XercesC_INCLUDE_DIR) -# Find all XercesC libraries -find_library(XercesC_LIBRARY NAMES "xerces-c" "xerces-c_3" "xerces-c_2" - DOC "Xerces-C++ libraries") -mark_as_advanced(XercesC_LIBRARY) +if(NOT XercesC_LIBRARY) + # Find all XercesC libraries + find_library(XercesC_LIBRARY_RELEASE + NAMES "xerces-c" "xerces-c_3" + DOC "Xerces-C++ libraries (release)") + find_library(XercesC_LIBRARY_DEBUG + NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D" + DOC "Xerces-C++ libraries (debug)") + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(XercesC) + mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG) +endif() if(XercesC_INCLUDE_DIR) _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 23d486e..e4018b6 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -229,9 +229,14 @@ function(is_file_executable file result_var) if(file_cmd) execute_process(COMMAND "${file_cmd}" "${file_full}" + RESULT_VARIABLE file_rv OUTPUT_VARIABLE file_ov + ERROR_VARIABLE file_ev OUTPUT_STRIP_TRAILING_WHITESPACE ) + if(NOT file_rv STREQUAL "0") + message(FATAL_ERROR "${file_cmd} failed: ${file_rv}\n${file_ev}") + endif() # Replace the name of the file in the output with a placeholder token # (the string " _file_full_ ") so that just in case the path name of @@ -543,11 +548,21 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(CYGPATH_EXECUTABLE) execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W + RESULT_VARIABLE env_rv OUTPUT_VARIABLE env_windir + ERROR_VARIABLE env_ev OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT env_rv STREQUAL "0") + message(FATAL_ERROR "${CYGPATH_EXECUTABLE} -W failed: ${env_rv}\n${env_ev}") + endif() execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S + RESULT_VARIABLE env_rv OUTPUT_VARIABLE env_sysdir + ERROR_VARIABLE env_ev OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT env_rv STREQUAL "0") + message(FATAL_ERROR "${CYGPATH_EXECUTABLE} -S failed: ${env_rv}\n${env_ev}") + endif() string(TOLOWER "${env_windir}" windir) string(TOLOWER "${env_sysdir}" sysroot) @@ -685,6 +700,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa return() endif() + set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results + if(gp_tool STREQUAL "ldd") set(gp_cmd_args "") set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$") @@ -709,6 +726,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 1) + # objdump generaates copious output so we create a grep filter to pre-filter results + find_program(gp_grep_cmd grep) + if(gp_grep_cmd) + set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ") + endif() else() message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...") message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'") @@ -765,8 +787,19 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # execute_process( COMMAND ${gp_cmd} ${gp_cmd_args} ${target} + ${gp_cmd_maybe_filter} + RESULT_VARIABLE gp_rv OUTPUT_VARIABLE gp_cmd_ov + ERROR_VARIABLE gp_ev ) + if(NOT gp_rv STREQUAL "0") + if(gp_tool STREQUAL "dumpbin") + # dumpbin error messages seem to go to stdout + message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}") + else() + message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}") + endif() + endif() if(gp_tool STREQUAL "ldd") set(ENV{LD_LIBRARY_PATH} "${old_ld_env}") @@ -791,8 +824,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(gp_tool STREQUAL "otool") execute_process( COMMAND otool -D ${target} + RESULT_VARIABLE otool_rv OUTPUT_VARIABLE gp_install_id_ov + ERROR_VARIABLE otool_ev ) + if(NOT otool_rv STREQUAL "0") + message(FATAL_ERROR "otool -D failed: ${otool_rv}\n${otool_ev}") + endif() # second line is install name string(REGEX REPLACE ".*:\n" "" gp_install_id "${gp_install_id_ov}") if(gp_install_id) diff --git a/Modules/Platform/ARTOS-GNU-C.cmake b/Modules/Platform/ARTOS-GNU-C.cmake new file mode 100644 index 0000000..967d0e7 --- /dev/null +++ b/Modules/Platform/ARTOS-GNU-C.cmake @@ -0,0 +1,9 @@ +# Define ARTOS to select proper behaviour and tell preprocessor to accept C++ style comments. +set(CMAKE_C_FLAGS_INIT "-DARTOS -Xp -+") +# ac doesn't support -g properly and doesn't support the normal gcc optimization options. Just use the defaults set by ac. +set(CMAKE_C_FLAGS_DEBUG_INIT "") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-DNDEBUG") +# Most projects expect the stdio functions to be available. +set(CMAKE_C_STANDARD_LIBRARIES_INIT "stdio.a") diff --git a/Modules/Platform/ARTOS.cmake b/Modules/Platform/ARTOS.cmake new file mode 100644 index 0000000..f9365d6 --- /dev/null +++ b/Modules/Platform/ARTOS.cmake @@ -0,0 +1,17 @@ +# Support for ARTOS RTOS (locamation.com) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") +set(CMAKE_EXECUTABLE_SUFFIX ".x") +set(CMAKE_DL_LIBS "") + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +# ARTOS does not support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_C_LINK_SHARED_LIBRARY ) +set(CMAKE_C_LINK_MODULE_LIBRARY ) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 65cc731..581301b 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -33,18 +33,11 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES # Initialize C and CXX link type selection flags. These flags are # used when building a shared library, shared module, or executable # that links to other libraries to select whether to use the static or -# shared versions of the libraries. Note that C modules and shared -# libs are built using ld directly so we leave off the "-Wl," portion. -foreach(type SHARED_LIBRARY SHARED_MODULE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") -endforeach() -foreach(type EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") -endforeach() +# shared versions of the libraries. foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") - set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") + foreach(lang C CXX) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-a,default") + endforeach() endforeach() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index aaa79c4..77946f2 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -7,14 +7,6 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") endif() -if(CMAKE_COMPILER_IS_GNUCXX) - if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_CREATE_SHARED_LIBRARY - "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - else() - # Take default rule from CMakeDefaultMakeRuleVariables.cmake. - endif() -endif() include(Platform/UnixPaths) # Add the compiler's implicit link directories. diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 5eb0ca8..c61591d 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -21,7 +21,8 @@ # # This command creates a <target_name>.jar. It compiles the given # source files (source) and adds the given resource files (resource) to -# the jar file. If only resource files are given then just a jar file +# the jar file. Source files can be java files or listing files +# (prefixed by '@'). If only resource files are given then just a jar file # is created. The list of include jars are added to the classpath when # compiling the java sources and also to the dependencies of the target. # INCLUDE_JARS also accepts other target names created by add_jar. For @@ -210,14 +211,16 @@ # # :: # -# install_jar(TARGET_NAME DESTINATION) +# install_jar(target_name destination) +# install_jar(target_name DESTINATION destination [COMPONENT component]) # # This command installs the TARGET_NAME files to the given DESTINATION. # It should be called in the same scope as add_jar() or it will fail. # # :: # -# install_jni_symlink(TARGET_NAME DESTINATION) +# install_jni_symlink(target_name destination) +# install_jni_symlink(target_name DESTINATION destination [COMPONENT component]) # # This command installs the TARGET_NAME JNI symlinks to the given # DESTINATION. It should be called in the same scope as add_jar() or it @@ -423,6 +426,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_CLASS_FILES) set(_JAVA_COMPILE_FILES) + set(_JAVA_COMPILE_FILELISTS) set(_JAVA_DEPENDS) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) @@ -433,7 +437,11 @@ function(add_jar _TARGET_NAME) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) - if (_JAVA_EXT MATCHES ".java") + if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$") + get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE) + list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) + + elseif (_JAVA_EXT MATCHES ".java") 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) @@ -492,11 +500,21 @@ function(add_jar _TARGET_NAME) file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") endif() - if (_JAVA_COMPILE_FILES) - # Create the list of files to compile. - set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources) - string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"") - file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING}) + if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS) + set (_JAVA_SOURCES_FILELISTS) + + if (_JAVA_COMPILE_FILES) + # Create the list of files to compile. + set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources) + string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"") + file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING}) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}") + endif() + if (_JAVA_COMPILE_FILELISTS) + foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}") + endforeach() + endif() # Compile the java files and create a list of class files add_custom_command( @@ -506,9 +524,9 @@ function(add_jar _TARGET_NAME) ${CMAKE_JAVA_COMPILE_FLAGS} -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - @${_JAVA_SOURCES_FILE} + ${_JAVA_SOURCES_FILELISTS} COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_DEPENDS} + DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Building Java objects for ${_TARGET_NAME}.jar" ) @@ -613,7 +631,26 @@ function(add_jar _TARGET_NAME) endfunction() -function(INSTALL_JAR _TARGET_NAME _DESTINATION) +function(INSTALL_JAR _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jar + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jar_DESTINATION) + set (_DESTINATION ${_install_jar_DESTINATION}) + else() + message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jar_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jar_COMPONENT}) + endif() + endif() + get_property(__FILES TARGET ${_TARGET_NAME} @@ -627,13 +664,33 @@ function(INSTALL_JAR _TARGET_NAME _DESTINATION) ${__FILES} DESTINATION ${_DESTINATION} + ${_COMPONENT} ) else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.") endif () endfunction() -function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) +function(INSTALL_JNI_SYMLINK _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jni_symlink + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jni_symlink_DESTINATION) + set (_DESTINATION ${_install_jni_symlink_DESTINATION}) + else() + message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jni_symlink_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT}) + endif() + endif() + get_property(__SYMLINK TARGET ${_TARGET_NAME} @@ -647,9 +704,10 @@ function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) ${__SYMLINK} DESTINATION ${_DESTINATION} + ${_COMPONENT} ) else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.") endif () endfunction() |