diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-10-13 14:52:34 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-10-13 14:52:34 (GMT) |
commit | 72b38e3aa7ba5fa4a70144e05de36bc99fda173a (patch) | |
tree | 744005aab47678a2a742267a01799a8f53dd0cf7 /Modules | |
parent | 8883613cc022d0ae2c96d84adf79dd82b74df658 (diff) | |
download | CMake-72b38e3aa7ba5fa4a70144e05de36bc99fda173a.zip CMake-72b38e3aa7ba5fa4a70144e05de36bc99fda173a.tar.gz CMake-72b38e3aa7ba5fa4a70144e05de36bc99fda173a.tar.bz2 |
ENH: merge changes from the main tree to the 2.4 branch
Diffstat (limited to 'Modules')
55 files changed, 1453 insertions, 430 deletions
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 8d05933..4e03bf3 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -72,10 +72,6 @@ IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) -IF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS) - SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS ${CMAKE_SHARED_MODULE_LINK_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS) - IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG) SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_FLAG}) ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG) @@ -84,6 +80,18 @@ IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP) SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP}) ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP) +# Initialize CXX link type selection flags from C versions. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) + SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS + ${CMAKE_${type}_LINK_STATIC_C_FLAGS}) + ENDIF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) + IF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) + SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS + ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS}) + ENDIF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) +ENDFOREACH(type) + # add the flags to the cache based # on the initial values computed in the platform/*.cmake files # use _INIT variables so that this only happens the first time diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 4d7ced5..03b019a 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -28,17 +28,18 @@ IF(NOT CMAKE_C_COMPILER) ENDIF(NOT CMAKE_C_COMPILER_INIT) ENDIF(CMAKE_GENERATOR_CC) - # if no compiler has been specified yet, then look for one - IF(NOT CMAKE_C_COMPILER_INIT) - # if not in the envionment then search for the compiler in the path + # finally list compilers to try + IF(CMAKE_C_COMPILER_INIT) + SET(CMAKE_C_COMPILER_LIST ${CMAKE_C_COMPILER_INIT}) + ELSE(CMAKE_C_COMPILER_INIT) SET(CMAKE_C_COMPILER_LIST gcc cc cl bcc xlc) - FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES ${CMAKE_C_COMPILER_LIST} ) - GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT - ${CMAKE_C_COMPILER_FULLPATH} NAME) - SET(CMAKE_C_COMPILER_FULLPATH "${CMAKE_C_COMPILER_FULLPATH}" CACHE INTERNAL "full path to the compiler cmake found") - ENDIF(NOT CMAKE_C_COMPILER_INIT) + ENDIF(CMAKE_C_COMPILER_INIT) - SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler") + # Find the compiler. + FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C compiler") + IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) + SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE) + ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) ENDIF(NOT CMAKE_C_COMPILER) MARK_AS_ADVANCED(CMAKE_C_COMPILER) GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_C_COMPILER}" diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 79683f5..ed909ce 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -28,17 +28,18 @@ IF(NOT CMAKE_CXX_COMPILER) ENDIF(NOT CMAKE_CXX_COMPILER_INIT) ENDIF(CMAKE_GENERATOR_CXX) - # if no compiler has been found yet, then try to find one - IF(NOT CMAKE_CXX_COMPILER_INIT) - # if not in the envionment then search for the compiler in the path + # finally list compilers to try + IF(CMAKE_CXX_COMPILER_INIT) + SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_CXX_COMPILER_INIT}) + ELSE(CMAKE_CXX_COMPILER_INIT) SET(CMAKE_CXX_COMPILER_LIST c++ g++ CC aCC cl bcc xlC) - FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES ${CMAKE_CXX_COMPILER_LIST}) - GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT - ${CMAKE_CXX_COMPILER_FULLPATH} NAME) - SET(CMAKE_CXX_COMPILER_FULLPATH "${CMAKE_CXX_COMPILER_FULLPATH}" CACHE INTERNAL "full path to the compiler cmake found") - ENDIF(NOT CMAKE_CXX_COMPILER_INIT) - SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_INIT} - CACHE STRING "C++ compiler") + ENDIF(CMAKE_CXX_COMPILER_INIT) + + # Find the compiler. + FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES ${CMAKE_CXX_COMPILER_LIST} DOC "C++ compiler") + IF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER) + SET(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER_INIT}" CACHE FILEPATH "C++ compiler" FORCE) + ENDIF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER) ENDIF(NOT CMAKE_CXX_COMPILER) MARK_AS_ADVANCED(CMAKE_CXX_COMPILER) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index edec369..232f6e8 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -25,10 +25,10 @@ IF(NOT CMAKE_Fortran_COMPILER) ENDIF(NOT CMAKE_Fortran_COMPILER_INIT) ENDIF(CMAKE_GENERATOR_FC) - - # if no compiler has been specified yet, then look for one - IF(NOT CMAKE_Fortran_COMPILER_INIT) - # if not in the envionment then search for the compiler in the path + # finally list compilers to try + IF(CMAKE_Fortran_COMPILER_INIT) + SET(CMAKE_Fortran_COMPILER_LIST ${CMAKE_Fortran_COMPILER_INIT}) + ELSE(CMAKE_Fortran_COMPILER_INIT) # Known compilers: # f77/f90/f95: generic compiler names # g77: GNU Fortran 77 compiler @@ -51,16 +51,17 @@ IF(NOT CMAKE_Fortran_COMPILER) # NOTE for testing purposes this list is DUPLICATED in # CMake/Source/CMakeLists.txt, IF YOU CHANGE THIS LIST, # PLEASE UPDATE THAT FILE AS WELL! - SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 - lf95 xlf95 fort gfortran f90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 ) - FIND_PROGRAM(CMAKE_Fortran_COMPILER_FULLPATH NAMES ${CMAKE_Fortran_COMPILER_LIST} ) - GET_FILENAME_COMPONENT(CMAKE_Fortran_COMPILER_INIT - ${CMAKE_Fortran_COMPILER_FULLPATH} NAME) - SET(CMAKE_Fortran_COMPILER_FULLPATH "${CMAKE_Fortran_COMPILER_FULLPATH}" - CACHE INTERNAL "full path to the compiler cmake found") - ENDIF(NOT CMAKE_Fortran_COMPILER_INIT) + SET(CMAKE_Fortran_COMPILER_LIST + ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran f90 + pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 + ) + ENDIF(CMAKE_Fortran_COMPILER_INIT) - SET(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_INIT} CACHE STRING "Fortran compiler") + # Find the compiler. + FIND_PROGRAM(CMAKE_Fortran_COMPILER NAMES ${CMAKE_Fortran_COMPILER_LIST} DOC "Fortran compiler") + IF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER) + SET(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_INIT}" CACHE FILEPATH "Fortran compiler" FORCE) + ENDIF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER) ENDIF(NOT CMAKE_Fortran_COMPILER) MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER) diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index e48f21f..b90f604 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -25,18 +25,18 @@ IF(NOT CMAKE_RC_COMPILER) ENDIF(NOT CMAKE_RC_COMPILER_INIT) ENDIF(CMAKE_GENERATOR_RC) - - # if no compiler has been specified yet, then look for one - IF(NOT CMAKE_RC_COMPILER_INIT) + # finally list compilers to try + IF(CMAKE_RC_COMPILER_INIT) + SET(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT}) + ELSE(CMAKE_RC_COMPILER_INIT) SET(CMAKE_RC_COMPILER_LIST rc) - FIND_PROGRAM(CMAKE_RC_COMPILER_FULLPATH NAMES ${CMAKE_RC_COMPILER_LIST} ) - GET_FILENAME_COMPONENT(CMAKE_RC_COMPILER_INIT - ${CMAKE_RC_COMPILER_FULLPATH} NAME) - SET(CMAKE_RC_COMPILER_FULLPATH "${CMAKE_RC_COMPILER_FULLPATH}" - CACHE INTERNAL "full path to the compiler cmake found") - ENDIF(NOT CMAKE_RC_COMPILER_INIT) + ENDIF(CMAKE_RC_COMPILER_INIT) - SET(CMAKE_RC_COMPILER ${CMAKE_RC_COMPILER_INIT} CACHE STRING "RC compiler") + # Find the compiler. + FIND_PROGRAM(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler") + IF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER) + SET(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE) + ENDIF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER) ENDIF(NOT CMAKE_RC_COMPILER) MARK_AS_ADVANCED(CMAKE_RC_COMPILER) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 80a8e7a..3413c05 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -63,10 +63,6 @@ IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) -IF(NOT CMAKE_SHARED_MODULE_LINK_Fortran_FLAGS) - SET(CMAKE_SHARED_MODULE_LINK_Fortran_FLAGS ${CMAKE_SHARED_MODULE_LINK_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_LINK_Fortran_FLAGS) - IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG) SET(CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG) diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 099c45e..53905eb 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -30,7 +30,6 @@ ENDIF(EXISTS ${CMAKE_SYSTEM_INFO_FILE}) IF(NOT CMAKE_MODULE_EXISTS) SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") - SET(CMAKE_SHARED_MODULE_LINK_C_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) ENDIF(NOT CMAKE_MODULE_EXISTS) diff --git a/Modules/CMakeVCManifest.cmake b/Modules/CMakeVCManifest.cmake new file mode 100644 index 0000000..6675f99 --- /dev/null +++ b/Modules/CMakeVCManifest.cmake @@ -0,0 +1,30 @@ + +# Leave the first line of this file empty so this module will not be +# included in the documentation. + +# This script is invoked from Windows-cl.cmake and passed the TARGET +# variable on the command line. + +# Conditionally embed the manifest in the executable if it exists. +IF(EXISTS "${TARGET}.manifest") + # Construct the manifest embedding command. + SET(CMD + mt ${CMAKE_CL_NOLOGO} /manifest ${TARGET}.manifest + /outputresource:${TARGET} + ) + + # Run the embedding command. + EXECUTE_PROCESS(COMMAND ${CMD}\;\#2 RESULT_VARIABLE RESULT) + + # Check whether the command failed. + IF(NOT "${RESULT}" MATCHES "^0$") + # The embedding failed remove the target and the manifest. + FILE(REMOVE ${TARGET} ${TARGET}.manifest) + + # Describe the failure in a message. + STRING(REGEX REPLACE ";" " " CMD "${CMD}") + MESSAGE(FATAL_ERROR + "Failed to embed manifest in ${TARGET} using command \"${CMD};#2\"" + ) + ENDIF(NOT "${RESULT}" MATCHES "^0$") +ENDIF(EXISTS "${TARGET}.manifest") diff --git a/Modules/COPYING-CMAKE-SCRIPTS b/Modules/COPYING-CMAKE-SCRIPTS new file mode 100644 index 0000000..4b41776 --- /dev/null +++ b/Modules/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake new file mode 100644 index 0000000..b084399 --- /dev/null +++ b/Modules/CheckCCompilerFlag.cmake @@ -0,0 +1,21 @@ +# - Check whether the C compiler supports a given flag. +# CHECK_C_COMPILER_FLAG(FLAG VARIABLE) +# +# FLAG - the compiler flag +# VARIABLE - variable to store the result + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +INCLUDE(CheckCSourceCompiles) + +MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) + SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}) + SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") +ENDMACRO (CHECK_C_COMPILER_FLAG) + diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 767b2af..f2716eb 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -2,7 +2,7 @@ # CHECK_C_SOURCE_COMPILES(SOURCE VAR) # - macro which checks if the source code compiles # SOURCE - source code to try to compile -# VAR - variable to store size if the type exists. +# VAR - variable to store whether the source code compiled # # The following variables may be set before calling this macro to # modify the way the check is run: @@ -41,16 +41,16 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) IF(${VAR}) - SET(${VAR} 1 CACHE INTERNAL "Test ${FUNCTION}") + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") ELSE(${VAR}) MESSAGE(STATUS "Performing Test ${VAR} - Failed") - SET(${VAR} "" CACHE INTERNAL "Test ${FUNCTION}") - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake new file mode 100644 index 0000000..d843e9a --- /dev/null +++ b/Modules/CheckCSourceRuns.cmake @@ -0,0 +1,68 @@ +# - Check if the source code provided in the SOURCE argument compiles and runs. +# CHECK_C_SOURCE_RUNS(SOURCE VAR) +# - macro which checks if the source code runs +# SOURCE - source code to try to compile +# VAR - variable to store size if the type exists. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) + IF("${VAR}" MATCHES "^${VAR}$") + SET(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + IF(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + ENDIF(CMAKE_REQUIRED_LIBRARIES) + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + ENDIF(CMAKE_REQUIRED_INCLUDES) + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + "${SOURCE}\n") + + MESSAGE(STATUS "Performing Test ${VAR}") + TRY_RUN(${VAR} ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + # if it did not compile make the return value fail code of 1 + IF(NOT ${VAR}_COMPILED) + SET(${VAR} 1) + ENDIF(NOT ${VAR}_COMPILED) + # if the return value was 0 then it worked + SET(result_var ${${VAR}}) + IF("${result_var}" EQUAL 0) + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + MESSAGE(STATUS "Performing Test ${VAR} - Success") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + ELSE("${result_var}" EQUAL 0) + MESSAGE(STATUS "Performing Test ${VAR} - Failed") + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${result_var}\n" + "Source file was:\n${SOURCE}\n") + ENDIF("${result_var}" EQUAL 0) + ENDIF("${VAR}" MATCHES "^${VAR}$") +ENDMACRO(CHECK_C_SOURCE_RUNS) + diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake new file mode 100644 index 0000000..43ea9a6 --- /dev/null +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -0,0 +1,21 @@ +# - Check whether the CXX compiler supports a given flag. +# CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE) +# +# FLAG - the compiler flag +# VARIABLE - variable to store the result + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +INCLUDE(CheckCXXSourceCompiles) + +MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) + SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}) + SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") +ENDMACRO (CHECK_CXX_COMPILER_FLAG) + diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index d8b8960..3921c89 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -1,8 +1,8 @@ # - Check if the source code provided in the SOURCE argument compiles. # CHECK_CXX_SOURCE_COMPILES(SOURCE VAR) -# - macro which checks if the source code compiles\ +# - macro which checks if the source code compiles # SOURCE - source code to try to compile -# VAR - variable to store size if the type exists. +# VAR - variable to store whether the source code compiled # # The following variables may be set before calling this macro to # modify the way the check is run: @@ -41,7 +41,7 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) IF(${VAR}) - SET(${VAR} 1 CACHE INTERNAL "Test ${FUNCTION}") + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" @@ -49,7 +49,7 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) "Source file was:\n${SOURCE}\n") ELSE(${VAR}) MESSAGE(STATUS "Performing Test ${VAR} - Failed") - SET(${VAR} "" CACHE INTERNAL "Test ${FUNCTION}") + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake new file mode 100644 index 0000000..04ae7a9 --- /dev/null +++ b/Modules/CheckCXXSourceRuns.cmake @@ -0,0 +1,68 @@ +# - Check if the source code provided in the SOURCE argument compiles and runs. +# CHECK_CXX_SOURCE_RUNS(SOURCE VAR) +# - macro which checks if the source code compiles +# SOURCE - source code to try to compile +# VAR - variable to store size if the type exists. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) + IF("${VAR}" MATCHES "^${VAR}$") + SET(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + IF(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) + ENDIF(CMAKE_REQUIRED_LIBRARIES) + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) + ENDIF(CMAKE_REQUIRED_INCLUDES) + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" + "${SOURCE}\n") + + MESSAGE(STATUS "Performing Test ${VAR}") + TRY_RUN(${VAR} ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + # if it did not compile make the return value fail code of 1 + IF(NOT ${VAR}_COMPILED) + SET(${VAR} 1) + ENDIF(NOT ${VAR}_COMPILED) + # if the return value was 0 then it worked + SET(result_var ${${VAR}}) + IF("${result_var}" EQUAL 0) + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + MESSAGE(STATUS "Performing Test ${VAR} - Success") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + ELSE("${result_var}" EQUAL 0) + MESSAGE(STATUS "Performing Test ${VAR} - Failed") + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + ENDIF("${result_var}" EQUAL 0) + ENDIF("${VAR}" MATCHES "^${VAR}$") +ENDMACRO(CHECK_CXX_SOURCE_RUNS) + diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake new file mode 100644 index 0000000..978407d --- /dev/null +++ b/Modules/FindASPELL.cmake @@ -0,0 +1,40 @@ +# - Try to find ASPELL +# Once done this will define +# +# ASPELL_FOUND - system has ASPELL +# ASPELL_INCLUDE_DIR - the ASPELL include directory +# ASPELL_LIBRARIES - The libraries needed to use ASPELL +# ASPELL_DEFINITIONS - Compiler switches required for using ASPELL + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) + # Already in cache, be silent + SET(ASPELL_FIND_QUIETLY TRUE) +ENDIF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) + +FIND_PATH(ASPELL_INCLUDE_DIR aspell.h ) + +FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15) + +IF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) + SET(ASPELL_FOUND TRUE) +ELSE (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) + SET(ASPELL_FOUND FALSE) +ENDIF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) + +IF (ASPELL_FOUND) + IF (NOT ASPELL_FIND_QUIETLY) + MESSAGE(STATUS "Found ASPELL: ${ASPELL_LIBRARIES}") + ENDIF (NOT ASPELL_FIND_QUIETLY) +ELSE (ASPELL_FOUND) + IF (ASPELL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find ASPELL") + ENDIF (ASPELL_FIND_REQUIRED) +ENDIF (ASPELL_FOUND) + +MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake new file mode 100644 index 0000000..c846424 --- /dev/null +++ b/Modules/FindBZip2.cmake @@ -0,0 +1,43 @@ +# - Try to find BZip2 +# Once done this will define +# +# BZIP2_FOUND - system has BZip2 +# BZIP2_INCLUDE_DIR - the BZip2 include directory +# BZIP2_LIBRARIES - Link these to use BZip2 +# BZIP2_DEFINITIONS - Compiler switches required for using BZip2 +# BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) + SET(BZip2_FIND_QUIETLY TRUE) +ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) + +FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ) + +FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 ) + +IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) + SET(BZIP2_FOUND TRUE) + INCLUDE(CheckLibraryExists) + CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) +ELSE (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) + SET(BZIP2_FOUND FALSE) +ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) + +IF (BZIP2_FOUND) + IF (NOT BZip2_FIND_QUIETLY) + MESSAGE(STATUS "Found BZip2: ${BZIP2_LIBRARIES}") + ENDIF (NOT BZip2_FIND_QUIETLY) +ELSE (BZIP2_FOUND) + IF (BZip2_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find BZip2") + ENDIF (BZip2_FIND_REQUIRED) +ENDIF (BZIP2_FOUND) + +MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES) + diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 6e6531a..fff6e4d 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -1,41 +1,79 @@ -# - this module looks for Doxygen and the path to Graphiz's dot +# - This module looks for Doxygen and the path to Graphiz's dot +# Doxygen is a documentation generation tool see http://www.doxygen.org # With the OS X GUI version, it likes to be installed to /Applications and # it contains the doxygen executable in the bundle. In the versions I've # seen, it is located in Resources, but in general, more often binaries are # located in MacOS. -FIND_PROGRAM(DOXYGEN - doxygen - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin" +IF (NOT DOXYGEN_FIND_QUIETLY) + MESSAGE(STATUS "Looking for doxygen...") +ENDIF (NOT DOXYGEN_FIND_QUIETLY) + +FIND_PROGRAM(DOXYGEN_EXECUTABLE + NAMES doxygen + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin" /Applications/Doxygen.app/Contents/Resources /Applications/Doxygen.app/Contents/MacOS + DOC "Doxygen documentation generation tool (http://www.doxygen.org)" ) +IF (DOXYGEN_EXECUTABLE) + SET (DOXYGEN_FOUND "YES") + IF (NOT DOXYGEN_FIND_QUIETLY) + MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN_EXECUTABLE}") + ENDIF (NOT DOXYGEN_FIND_QUIETLY) +ELSE (DOXYGEN_EXECUTABLE) + IF (NOT DOXYGEN_FIND_QUIETLY) + IF (DOXYGEN_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Looking for doxygen... - NOT found") + ELSE (DOXYGEN_FIND_REQUIRED) + MESSAGE(STATUS "Looking for doxygen... - NOT found") + ENDIF (DOXYGEN_FIND_REQUIRED) + ENDIF (NOT DOXYGEN_FIND_QUIETLY) +ENDIF (DOXYGEN_EXECUTABLE) + # In the older versions of OS X Doxygen, dot was included with the # Doxygen bundle. But the new versions place make you download Graphviz.app # which contains dot in its bundle. -FIND_PROGRAM(DOT - dot - "$ENV{ProgramFiles}/ATT/Graphviz/bin" +IF (NOT DOXYGEN_FIND_QUIETLY) + MESSAGE(STATUS "Looking for dot tool...") +ENDIF (NOT DOXYGEN_FIND_QUIETLY) + +FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE + NAMES dot + PATHS "$ENV{ProgramFiles}/ATT/Graphviz/bin" "C:/Program Files/ATT/Graphviz/bin" [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin /Applications/Graphviz.app/Contents/MacOS /Applications/Doxygen.app/Contents/Resources /Applications/Doxygen.app/Contents/MacOS + DOC "Graphiz Dot tool for using Doxygen" ) +IF (NOT DOXYGEN_FIND_QUIETLY) + IF (DOXYGEN_DOT_EXECUTABLE) + MESSAGE(STATUS "Looking for dot tool... - found ${DOXYGEN_DOT_EXECUTABLE}") + ELSE (DOXYGEN_DOT_EXECUTABLE) + MESSAGE(STATUS "Looking for dot tool... - NOT found") + ENDIF (DOXYGEN_DOT_EXECUTABLE) +ENDIF (NOT DOXYGEN_FIND_QUIETLY) + + # The Doxyfile wants the path to Dot, not the entire path and executable -# so for convenience, I'll add another search for DOT_PATH. -FIND_PATH(DOT_PATH +# so for convenience, I'll add another search for DOXYGEN_DOT_PATH. +FIND_PATH(DOXYGEN_DOT_PATH dot "C:/Program Files/ATT/Graphviz/bin" [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin /Applications/Graphviz.app/Contents/MacOS /Applications/Doxygen.app/Contents/Resources /Applications/Doxygen.app/Contents/MacOS + DOC "Path to the Graphviz Dot tool" ) MARK_AS_ADVANCED( - DOT - DOT_PATH - DOXYGEN -) + DOXYGEN_FOUND, + DOXYGEN_EXECUTABLE, + DOXYGEN_DOT_FOUND, + DOXYGEN_DOT_EXECUTABLE, + DOXYGEN_DOT_PATH, + ) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index e88a55f..f6fa551 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -45,7 +45,7 @@ ELSE (WIN32) /System/Library/Frameworks/GLUT.framework/Versions/A/Headers ${OPENGL_LIBRARY_DIR} ) - SET(GLUT_glut_LIBRARY "-framework Glut" CACHE STRING "GLUT library for OSX") + SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") ELSE (APPLE) diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake new file mode 100644 index 0000000..a2b93a7 --- /dev/null +++ b/Modules/FindHSPELL.cmake @@ -0,0 +1,42 @@ +# - Try to find HSPELL +# Once done this will define +# +# HSPELL_FOUND - system has HSPELL +# HSPELL_INCLUDE_DIR - the HSPELL include directory +# HSPELL_LIBRARIES - The libraries needed to use HSPELL +# HSPELL_DEFINITIONS - Compiler switches required for using HSPELL + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) + # Already in cache, be silent + SET(HSPELL_FIND_QUIETLY TRUE) +ENDIF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) + + +FIND_PATH(HSPELL_INCLUDE_DIR hspell.h ) + +FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell ) + +IF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) + SET(HSPELL_FOUND TRUE) +ELSE (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) + SET(HSPELL_FOUND FALSE) +ENDIF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) + +IF (HSPELL_FOUND) + IF (NOT HSPELL_FIND_QUIETLY) + MESSAGE(STATUS "Found HSPELL: ${HSPELL_LIBRARIES}") + ENDIF (NOT HSPELL_FIND_QUIETLY) +ELSE (HSPELL_FOUND) + IF (HSPELL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find HSPELL") + ENDIF (HSPELL_FIND_REQUIRED) +ENDIF (HSPELL_FOUND) + +MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) + diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake new file mode 100644 index 0000000..ac284c3 --- /dev/null +++ b/Modules/FindJasper.cmake @@ -0,0 +1,43 @@ +# - Try to find the Jasper JPEG2000 library +# Once done this will define +# +# JASPER_FOUND - system has Jasper +# JASPER_INCLUDE_DIR - the Jasper include directory +# JASPER_LIBRARIES - The libraries needed to use Jasper + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +FIND_PACKAGE(JPEG) + +IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES) + # Already in cache, be silent + SET(Jasper_FIND_QUIETLY TRUE) +ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES) + +FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h) + +FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper) + +IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) + SET(JASPER_FOUND TRUE) + SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} ) +ELSE (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) + SET(JASPER_FOUND FALSE) +ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) + + +IF (JASPER_FOUND) + IF (NOT Jasper_FIND_QUIETLY) + MESSAGE(STATUS "Found jasper: ${JASPER_LIBRARIES}") + ENDIF (NOT Jasper_FIND_QUIETLY) +ELSE (JASPER_FOUND) + IF (Jasper_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find jasper library") + ENDIF (Jasper_FIND_REQUIRED) +ENDIF (JASPER_FOUND) + +MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY) diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index b2e702c..f1545a0 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -5,7 +5,7 @@ # KDE3_INCLUDE_DIR - the KDE include directory # KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES() # KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES() -# QT_AND_KDECORE_LIBRARIES - this contains both the Qt and the kdecore library +# QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library # KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable # KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable # KDE3_KCFGC_EXECUTABLE - the kconfig_compiler executable @@ -98,56 +98,101 @@ ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD) #SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") #SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +# all calls to FIND_PROGRAM/PATH/LIBRARY() follow the same scheme: +# at first try some special paths with the argument "NO_DEFAULT_PATH" +# so only these paths are checked +# this is followed by a second call to FIND_PROGRAM/PATH/LIBRARY() +# but this time without any paths and without NO_DEFAULT_PATH +# this second call will do nothing if the first call already found +# what it was looking for, if not, it will search only in the default +# directories (/usr, /usr/local, etc.) + #now try to find some kde stuff +FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config PATHS + $ENV{KDEDIR}/bin + /opt/kde3/bin + /opt/kde/bin + NO_DEFAULT_PATH + ) + + +FIND_PROGRAM(KDECONFIG_EXECUTABLE kde-config) + + +SET(KDE3PREFIX) +IF(KDECONFIG_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE kde_config_version ) -#at first the KDE include direcory + STRING(REGEX MATCH "KDE: .\\." kde_version ${kde_config_version}) + IF (${kde_version} MATCHES "KDE: 3\\.") + EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix + OUTPUT_VARIABLE kdedir ) + STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") + + ENDIF (${kde_version} MATCHES "KDE: 3\\.") +ENDIF(KDECONFIG_EXECUTABLE) + + + +# at first the KDE include direcory # kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h $ENV{KDEDIR}/include - /opt/kde/include + ${KDE3PREFIX}/include /opt/kde3/include - /usr/local/include - /usr/include/ + /opt/kde/include /usr/include/kde /usr/local/include/kde -) + NO_DEFAULT_PATH + ) + +FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h) #now the KDE library directory FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore PATHS $ENV{KDEDIR}/lib - /opt/kde/lib + ${KDE3PREFIX}/lib /opt/kde3/lib - /usr/lib - /usr/local/lib + /opt/kde/lib + NO_DEFAULT_PATH ) -GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) +FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore) -#now the KDE service types directory -#FIND_PATH(KDE3_SERVICETYPES_DIR ktexteditor.desktop -# $ENV{KDEDIR}/share/servicetypes/ -# /opt/kde/share/servicetypes/ -# /opt/kde3/share/servicetypes/ -#) +GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) #now search for the dcop utilities -FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAME dcopidl PATHS +FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl PATHS $ENV{KDEDIR}/bin - /opt/kde/bin + ${KDE3PREFIX}/bin /opt/kde3/bin + /opt/kde/bin + NO_DEFAULT_PATH ) -FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAME dcopidl2cpp PATHS +FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl) + +FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp PATHS $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin + /opt/kde3/bin /opt/kde/bin - /opt/kde3/bin) + NO_DEFAULT_PATH + ) -FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS +FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp) + +FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler PATHS $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin + /opt/kde3/bin /opt/kde/bin - /opt/kde3/bin) + NO_DEFAULT_PATH + ) +FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler) # KDE3Macros.cmake contains all the KDE specific macros INCLUDE(KDE3Macros) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake new file mode 100644 index 0000000..b45d729 --- /dev/null +++ b/Modules/FindLibXml2.cmake @@ -0,0 +1,59 @@ +# - Try to find LibXml2 +# Once done this will define +# +# LIBXML2_FOUND - system has LibXml2 +# LIBXML2_INCLUDE_DIR - the LibXml2 include directory +# LIBXML2_LIBRARIES - the libraries needed to use LibXml2 +# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2 +# +# Copyright (c) 2006, Alexander Neundorf <neundorf@kde.org> +# This code is available under the BSD license, see licenses/BSD for details. + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + # in cache already + SET(LibXml2_FIND_QUIETLY TRUE) +ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + INCLUDE(UsePkgConfig) + PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags _LibXml2Cflags) + SET(LIBXML2_DEFINITIONS ${_LibXml2Cflags}) +ENDIF (NOT WIN32) + +FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h + PATHS + ${_LibXml2IncDir} + PATH_SUFFIXES libxml2 + ) + +FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 + PATHS + ${_LibXml2LinkDir} + ) + +IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + SET(LIBXML2_FOUND TRUE) +ELSE (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + SET(LIBXML2_FOUND FALSE) +ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + +IF (LIBXML2_FOUND) + IF (NOT LibXml2_FIND_QUIETLY) + MESSAGE(STATUS "Found LibXml2: ${LIBXML2_LIBRARIES}") + ENDIF (NOT LibXml2_FIND_QUIETLY) +ELSE (LIBXML2_FOUND) + IF (LibXml2_FIND_REQUIRED) + MESSAGE(SEND_ERROR "Could NOT find LibXml2") + ENDIF (LibXml2_FIND_REQUIRED) +ENDIF (LIBXML2_FOUND) + +MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES) + diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake new file mode 100644 index 0000000..fcebd0c --- /dev/null +++ b/Modules/FindLibXslt.cmake @@ -0,0 +1,54 @@ +# - Try to find LibXslt +# Once done this will define +# +# LIBXSLT_FOUND - system has LibXslt +# LIBXSLT_INCLUDE_DIR - the LibXslt include directory +# LIBXSLT_LIBRARIES - Link these to LibXslt +# LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) + # in cache already + SET(LibXslt_FIND_QUIETLY TRUE) +ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + INCLUDE(UsePkgConfig) + PKGCONFIG(libxslt _LibXsltIncDir _LibXsltLinkDir _LibXsltLinkFlags _LibXsltCflags) + SET(LIBXSLT_DEFINITIONS ${_LibXsltCflags}) +ENDIF (NOT WIN32) + +FIND_PATH(LIBXSLT_INCLUDE_DIR libxslt/xslt.h + ${_LibXsltIncDir} + ) + +FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt + PATHS + ${_LibXsltLinkDir} + ) + +IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) + SET(LIBXSLT_FOUND TRUE) +ELSE (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) + SET(LIBXSLT_FOUND FALSE) +ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) + +IF (LIBXSLT_FOUND) + IF (NOT LibXslt_FIND_QUIETLY) + MESSAGE(STATUS "Found LibXslt: ${LIBXSLT_LIBRARIES}") + ENDIF (NOT LibXslt_FIND_QUIETLY) +ELSE (LIBXSLT_FOUND) + IF (LibXslt_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find LibXslt") + ENDIF (LibXslt_FIND_REQUIRED) +ENDIF (LIBXSLT_FOUND) + +MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES) + diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake new file mode 100644 index 0000000..0172df8 --- /dev/null +++ b/Modules/FindOpenSSL.cmake @@ -0,0 +1,70 @@ +# - Try to find the OpenSSL encryption library
+# Once done this will define
+#
+# OPENSSL_FOUND - system has the OpenSSL library
+# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
+# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF(OPENSSL_LIBRARIES)
+ SET(OpenSSL_FIND_QUIETLY TRUE)
+ENDIF(OPENSSL_LIBRARIES)
+
+IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ SET(LIB_FOUND 1)
+ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+
+FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h )
+
+IF(WIN32 AND MSVC)
+ # /MD and /MDd are the standard values - if somone wants to use
+ # others, the libnames have to change here too
+ # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
+
+ FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32)
+ FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32)
+
+ IF(MSVC_IDE)
+ IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG})
+ ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ MESSAGE(FATAL_ERROR "Could not find the debug and release version of openssl")
+ ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ ELSE(MSVC_IDE)
+ STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG})
+ ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE})
+ ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ ENDIF(MSVC_IDE)
+ MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
+ELSE(WIN32 AND MSVC)
+
+ FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD )
+
+ENDIF(WIN32 AND MSVC)
+
+IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
+ SET(OPENSSL_FOUND TRUE)
+ELSE(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
+ SET(OPENSSL_FOUND FALSE)
+ENDIF (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
+
+IF (OPENSSL_FOUND)
+ IF (NOT OpenSSL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found OpenSSL: ${OPENSSL_LIBRARIES}")
+ ENDIF (NOT OpenSSL_FIND_QUIETLY)
+ELSE (OPENSSL_FOUND)
+ IF (OpenSSL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find OpenSSL")
+ ENDIF (OpenSSL_FIND_REQUIRED)
+ENDIF (OPENSSL_FOUND)
+
+MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
+
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index f078242..797dd02 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -12,10 +12,13 @@ # PNG depends on Zlib INCLUDE(FindZLIB) +SET(PNG_FOUND "NO") + IF(ZLIB_FOUND) FIND_PATH(PNG_PNG_INCLUDE_DIR png.h /usr/local/include /usr/include + /usr/local/include/libpng # OpenBSD ) SET(PNG_NAMES ${PNG_NAMES} png libpng) @@ -42,4 +45,14 @@ IF(ZLIB_FOUND) ENDIF(ZLIB_FOUND) +IF (PNG_FOUND) + IF (NOT PNG_FIND_QUIETLY) + MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}") + ENDIF (NOT PNG_FIND_QUIETLY) +ELSE (PNG_FOUND) + IF (PNG_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find PNG library") + ENDIF (PNG_FIND_REQUIRED) +ENDIF (PNG_FOUND) + MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY ) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index c0c5805..44a932d 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -7,8 +7,9 @@ # FIND_PROGRAM(PYTHON_EXECUTABLE - NAMES python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python + NAMES python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath] diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 9379ff4..3c07225 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -12,8 +12,10 @@ INCLUDE(CMakeFindFrameworks) IF(WIN32) FIND_LIBRARY(PYTHON_DEBUG_LIBRARY - NAMES python24_d python23_d python22_d python21_d python20_d python + NAMES python25_d python24_d python23_d python22_d python21_d python20_d python PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/libs/Debug + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/libs [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs/Debug [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs/Debug @@ -32,7 +34,8 @@ IF(WIN32) ENDIF(WIN32) FIND_LIBRARY(PYTHON_LIBRARY - NAMES python24 python2.4 + NAMES python25 python2.5 + python24 python2.4 python23 python2.3 python22 python2.2 python21 python2.1 @@ -41,6 +44,7 @@ FIND_LIBRARY(PYTHON_LIBRARY python15 python1.5 PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/libs [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs @@ -50,6 +54,7 @@ FIND_LIBRARY(PYTHON_LIBRARY [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs PATH_SUFFIXES + python2.5/config python2.4/config python2.3/config python2.2/config @@ -67,7 +72,7 @@ CMAKE_FIND_FRAMEWORKS(Python) SET(PYTHON_FRAMEWORK_INCLUDES) IF(Python_FRAMEWORKS) IF(NOT PYTHON_INCLUDE_PATH) - FOREACH(version 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + FOREACH(version 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) FOREACH(dir ${Python_FRAMEWORKS}) SET(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES} ${dir}/Versions/${version}/include/python${version}) @@ -81,6 +86,7 @@ FIND_PATH(PYTHON_INCLUDE_PATH PATHS ${PYTHON_FRAMEWORK_INCLUDES} + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/include [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/include [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/include [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/include @@ -90,6 +96,7 @@ FIND_PATH(PYTHON_INCLUDE_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include PATH_SUFFIXES + python2.5 python2.4 python2.3 python2.2 diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 3fb188d..5926318 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -28,10 +28,9 @@ FIND_PATH(QT_INCLUDE_DIR qt.h $ENV{QTDIR}/include ${GLOB_PATHS_BIN} /usr/local/qt/include - /usr/local/include /usr/lib/qt/include + /usr/lib/qt3/include /usr/include/qt - /usr/include /usr/share/qt3/include C:/Progra~1/qt/include /usr/include/qt3 @@ -61,7 +60,7 @@ IF (QT_MT_REQUIRED) FIND_LIBRARY(QT_QT_LIBRARY NAMES qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib} - qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 + qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3 PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" @@ -69,9 +68,9 @@ IF (QT_MT_REQUIRED) $ENV{QTDIR}/lib ${GLOB_PATHS_LIB} /usr/local/qt/lib - /usr/local/lib /usr/lib/qt/lib - /usr/lib + /usr/lib/qt3/lib + /usr/lib/qt3/lib64 /usr/share/qt3/lib C:/Progra~1/qt/lib /usr/X11R6/lib @@ -82,7 +81,7 @@ ELSE (QT_MT_REQUIRED) NAMES qt qt-${qt_version_str_lib} qt-edu${qt_version_str_lib} qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib} - qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 + qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3 PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" @@ -90,9 +89,9 @@ ELSE (QT_MT_REQUIRED) $ENV{QTDIR}/lib ${GLOB_PATHS_LIB} /usr/local/qt/lib - /usr/local/lib /usr/lib/qt/lib - /usr/lib + /usr/lib/qt3/lib + /usr/lib/qt3/lib64 /usr/share/qt3/lib C:/Progra~1/qt/lib /usr/X11R6/lib @@ -113,8 +112,8 @@ FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY $ENV{QTDIR}/lib ${GLOB_PATHS_LIB} /usr/local/qt/lib - /usr/local/lib - /usr/lib + /usr/lib/qt3/lib + /usr/lib/qt3/lib64 /usr/share/qt3/lib C:/Progra~1/qt/lib /usr/X11R6/lib @@ -138,6 +137,7 @@ FIND_PROGRAM(QT_MOC_EXECUTABLE ${GLOB_PATHS_BIN} /usr/local/qt/bin /usr/lib/qt/bin + /usr/lib/qt3/bin /usr/share/qt3/bin C:/Progra~1/qt/bin /usr/X11R6/bin @@ -162,6 +162,7 @@ FIND_PROGRAM(QT_UIC_EXECUTABLE uic ${GLOB_PATHS_BIN} /usr/local/qt/bin /usr/lib/qt/bin + /usr/lib/qt3/bin /usr/share/qt3/bin C:/Progra~1/qt/bin /usr/X11R6/bin diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 3b11596..d910747 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -19,6 +19,9 @@ # QT_USE_QTOPENGL # QT_USE_QTSQL # QT_USE_QTXML +# QT_USE_QTSVG +# QT_USE_QTTEST +# QT_USE_QTUITOOLS # # All the libraries required are stored in a variable called QT_LIBRARIES. # Add this variable to your TARGET_LINK_LIBRARIES. @@ -45,6 +48,7 @@ # QT_QTXML_FOUND True if QtXml was found. # QT_QTSVG_FOUND True if QtSvg was found. # QT_QTTEST_FOUND True if QtTest was found. +# QT_QTUITOOLS_FOUND True if QtUiTools was found. # # QT_DEFINITIONS Definitions to use when compiling code that uses Qt. # @@ -167,26 +171,48 @@ SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) SET( QT_DEFINITIONS "") -IF (WIN32) - SET(QT_DEFINITIONS -DQT_DLL) -ENDIF(WIN32) - # check for qmake FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt4 PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" $ENV{QTDIR}/bin -) + ) SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) +## macro for asking qmake to process pro files +MACRO(QT_QUERY_QMAKE outvar invar) + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro + "message(CMAKE_MESSAGE<$$${invar}>)") + EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} + WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake + OUTPUT_VARIABLE _qmake_query_output + ERROR_VARIABLE _qmake_query_output ) + FILE(REMOVE_RECURSE + "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") + STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") +ENDMACRO(QT_QUERY_QMAKE) + IF (QT_QMAKE_EXECUTABLE) SET(QT4_QMAKE_FOUND FALSE) EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) - + # check for qt3 qmake and then try and find qmake-qt4 in the path + IF("${QTVERSION}" MATCHES "Unknown") + SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) + FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake-qt4 PATHS + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" + $ENV{QTDIR}/bin + ) + IF(QT_QMAKE_EXECUTABLE) + EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + ENDIF(QT_QMAKE_EXECUTABLE) + ENDIF("${QTVERSION}" MATCHES "Unknown") # check that we found the Qt4 qmake, Qt3 qmake output won't match here STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}") IF (qt_version_tmp) @@ -226,7 +252,6 @@ IF (QT_QMAKE_EXECUTABLE) ELSE (found_vers LESS req_vers) SET(QT4_QMAKE_FOUND TRUE) ENDIF (found_vers LESS req_vers) - ENDIF (qt_version_tmp) ENDIF (QT_QMAKE_EXECUTABLE) @@ -391,7 +416,7 @@ IF (QT4_QMAKE_FOUND) ) # Set QT_QTUITOOLS_INCLUDE_DIR - FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtTest + FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtUiTools PATHS ${QT_INCLUDE_DIR}/QtUiTools ${QT_LIBRARY_DIR}/QtUiTools.framework/Headers @@ -467,11 +492,9 @@ IF (QT4_QMAKE_FOUND) # Set QT_INCLUDES SET( QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default ) - - # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) - FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QT3SUPPORT_LIBRARY FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) @@ -523,7 +546,7 @@ IF (QT4_QMAKE_FOUND) IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check CMakeFiles/CMakeError.log for more details.") + MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) @@ -535,6 +558,14 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + # Set QT_QTMAIN_LIBRARY + IF(WIN32) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain PATHS ${QT_LIBRARY_DIR} + NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmaind PATHS ${QT_LIBRARY_DIR} + NO_DEFAULT_PATH) + ENDIF(WIN32) + ############################################ # # Check the existence of the libraries. @@ -557,13 +588,16 @@ IF (QT4_QMAKE_FOUND) SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) - IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - IF(NOT MSVC) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) - ELSE(NOT MSVC) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF(NOT MSVC) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) @@ -582,7 +616,10 @@ IF (QT4_QMAKE_FOUND) ENDMACRO (_QT4_ADJUST_LIB_VARS) IF(WIN32) + # there is no include for qtmain but adjust macro needs it set + SET(QT_QTMAIN_INCLUDE_DIR 1) _QT4_ADJUST_LIB_VARS(QTMAIN) + SET(QT_QTMAIN_INCLUDE_DIR ) ENDIF(WIN32) @@ -603,6 +640,8 @@ IF (QT4_QMAKE_FOUND) _QT4_ADJUST_LIB_VARS(QTUITOOLS) _QT4_ADJUST_LIB_VARS(QTTEST) + + ####################################### # # Check the executables of Qt @@ -612,23 +651,8 @@ IF (QT4_QMAKE_FOUND) # find moc and uic using qmake - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro - "message(MOC<$$QMAKE_MOC>) - message(UIC<$$QMAKE_UIC>) - ") - - EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake - OUTPUT_VARIABLE _moc_OUTPUT - ERROR_VARIABLE _moc_OUTPUT ) - FILE(REMOVE_RECURSE - "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") - - STRING(REGEX REPLACE - ".*MOC<([^>]+).*" "\\1" QT_MOC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" ) - STRING(REGEX REPLACE - ".*UIC<([^>]+).*" "\\1" QT_UIC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" ) + QT_QUERY_QMAKE(QT_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC") + QT_QUERY_QMAKE(QT_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC") FILE(TO_CMAKE_PATH "${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL) @@ -820,23 +844,142 @@ IF (QT4_QMAKE_FOUND) ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) SET(QT_FOUND ${QT4_FOUND}) - ####################################### # - # System dependent settings + # Qt configuration # ####################################### - # for unix add X11 stuff - IF(UNIX) - # on OS X X11 may not be required - IF (Q_WS_X11) - FIND_PACKAGE(X11) - ENDIF (Q_WS_X11) - FIND_PACKAGE(Threads) - SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) - ENDIF(UNIX) + IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") + FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents) + STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG ${_qconfig_FILE_contents}) + STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG ${_qconfig_FILE_contents}) + ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") + ############################################### + # + # configuration/system dependent settings + # + ############################################### + + SET(QT_GUI_LIB_DEPENDENCIES "") + SET(QT_CORE_LIB_DEPENDENCIES "") + + # shared build needs -DQT_SHARED + IF(NOT QT_CONFIG MATCHES "static") + # warning currently only qconfig.pri on Windows potentially contains "static" + # so QT_SHARED might not get defined properly on Mac/X11 (which seems harmless right now) + # Trolltech said they'd consider exporting it for all platforms in future releases. + SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_SHARED) + ENDIF(NOT QT_CONFIG MATCHES "static") + + ## system png + IF(QT_QCONFIG MATCHES "system-png") + FIND_LIBRARY(QT_PNG_LIBRARY NAMES png) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) + MARK_AS_ADVANCED(QT_PNG_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "system-png") + + # for X11, get X11 library directory + IF(Q_WS_X11) + QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11") + ENDIF(Q_WS_X11) + + ## X11 SM + IF(QT_QCONFIG MATCHES "x11sm") + # ask qmake where the x11 libs are + FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) + FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) + MARK_AS_ADVANCED(QT_X11_SM_LIBRARY) + MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "x11sm") + + ## Xi + IF(QT_QCONFIG MATCHES "tablet") + FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) + MARK_AS_ADVANCED(QT_XI_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "tablet") + + ## Xrender + IF(QT_QCONFIG MATCHES "xrender") + FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) + MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "xrender") + + ## Xrandr + IF(QT_QCONFIG MATCHES "xrandr") + FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) + MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "xrandr") + + ## Xcursor + IF(QT_QCONFIG MATCHES "xcursor") + FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) + MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "xcursor") + + ## Xinerama + IF(QT_QCONFIG MATCHES "xinerama") + FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) + MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "xinerama") + + ## system-freetype + IF(QT_QCONFIG MATCHES "system-freetype") + FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) + MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "system-freetype") + + ## fontconfig + IF(QT_QCONFIG MATCHES "fontconfig") + FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) + MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "fontconfig") + + ## system-zlib + IF(QT_QCONFIG MATCHES "system-zlib") + FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z) + SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) + MARK_AS_ADVANCED(QT_ZLIB_LIBRARY) + ENDIF(QT_QCONFIG MATCHES "system-zlib") + + IF(Q_WS_X11) + # X11 libraries Qt absolutely depends on + QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11") + SEPARATE_ARGUMENTS(QT_LIBS_X11) + FOREACH(QT_X11_LIB ${QT_LIBS_X11}) + STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") + SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") + FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) + ENDFOREACH(QT_X11_LIB) + + QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") + SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) + + QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD") + SET (QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD}) + + ENDIF(Q_WS_X11) + + IF(Q_WS_WIN) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} Imm32 Winmm) + SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} Ws2_32) + ENDIF(Q_WS_WIN) + + IF(Q_WS_MAC) + SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} "-framework Carbon" "-framework QuickTime") + SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} "-framework ApplicationServices") + ENDIF(Q_WS_MAC) + ####################################### # # compatibility settings diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 5052614..943b131 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -1,34 +1,54 @@ -# - Find ruby -# This module finds if RUBY is installed and determines where the include files +# - Find Ruby +# This module finds if Ruby is installed and determines where the include files # and libraries are. It also determines what the name of the library is. This # code sets the following variables: # # RUBY_INCLUDE_PATH = path to where ruby.h can be found # RUBY_EXECUTABLE = full path to the ruby binary -# -SET(RUBY_POSSIBLE_INCLUDE_PATHS - /usr/lib/ruby/1.8/i386-linux - ) +# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. +# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. -SET(RUBY_POSSIBLE_LIB_PATHS - /usr/lib - ) -FIND_PATH(RUBY_INCLUDE_PATH ruby.h - ${RUBY_POSSIBLE_INCLUDE_PATHS}) +if(RUBY_LIBRARY AND RUBY_INCLUDE_PATH) + # Already in cache, be silent + set(RUBY_FIND_QUIETLY TRUE) +endif (RUBY_LIBRARY AND RUBY_INCLUDE_PATH) + +# RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'` +# RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'` +# RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'` +# RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'` +# RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'` + +FIND_PROGRAM(RUBY_EXECUTABLE NAMES ruby ruby1.8 ruby18 ) + +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['archdir']" + OUTPUT_VARIABLE RUBY_ARCH_DIR) -FIND_LIBRARY(RUBY_LIBRARY - NAMES ruby1.8 - PATHS ${RUBY_POSSIBLE_LIB_PATHS} - ) -FIND_PROGRAM(RUBY_EXECUTABLE - NAMES ruby1.8 +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['libdir']" + OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_PATH) + +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['rubylibdir']" + OUTPUT_VARIABLE RUBY_RUBY_LIB_PATH) + +# remove the new lines from the output by replacing them with empty strings +STRING(REPLACE "\n" "" RUBY_ARCH_DIR "${RUBY_ARCH_DIR}") +STRING(REPLACE "\n" "" RUBY_POSSIBLE_LIB_PATH "${RUBY_POSSIBLE_LIB_PATH}") +STRING(REPLACE "\n" "" RUBY_RUBY_LIB_PATH "${RUBY_RUBY_LIB_PATH}") + + +FIND_PATH(RUBY_INCLUDE_PATH + NAMES ruby.h PATHS - /usr/bin - /usr/local/bin -) + ${RUBY_ARCH_DIR} + /usr/lib/ruby/1.8/i586-linux-gnu/ ) + +FIND_LIBRARY(RUBY_LIBRARY + NAMES ruby + PATHS ${RUBY_POSSIBLE_LIB_PATH} + ) MARK_AS_ADVANCED( RUBY_EXECUTABLE diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 21b96df..62766d6 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -159,3 +159,4 @@ IF(SDL_LIBRARY_TEMP) SET(SDL_FOUND "YES") ENDIF(SDL_LIBRARY_TEMP) +MARK_AS_ADVANCED(SDL_LIBRARY_TEMP) diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 79a4611..d43b75d 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -137,8 +137,9 @@ IF (WIN32) ${TCLTK_POSSIBLE_INCLUDE_PATHS} ) MARK_AS_ADVANCED(TK_INTERNAL_PATH) +ENDIF(WIN32) - MARK_AS_ADVANCED( +MARK_AS_ADVANCED( TCL_TCLSH_PATH TK_WISH_PATH TCL_INCLUDE_PATH @@ -147,13 +148,10 @@ IF (WIN32) TCL_LIBRARY_DEBUG TK_LIBRARY TK_LIBRARY_DEBUG - ) -ENDIF(WIN32) - -MARK_AS_ADVANCED( TCL_STUB_LIBRARY TCL_STUB_LIBRARY_DEBUG TK_STUB_LIBRARY + TK_STUB_LIBRARY TK_STUB_LIBRARY_DEBUG ) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 7e0fb33..fc0bbb5 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -539,8 +539,8 @@ ELSE(WIN32_STYLE_FIND) SET(wxWidgets_FOUND TRUE) # run the wx-config program to get cxxflags - EXEC_PROGRAM(${wxWidgets_CONFIG_EXECUTABLE} - ARGS "--cxxflags" + EXEC_PROGRAM(sh + ARGS "${wxWidgets_CONFIG_EXECUTABLE} --cxxflags" OUTPUT_VARIABLE wxWidgets_CXX_FLAGS RETURN_VALUE RET) IF(RET EQUAL 0) @@ -583,8 +583,8 @@ ELSE(WIN32_STYLE_FIND) # be useful here... #STRING(REPLACE ";" "," wxWidgets_USE_LIBS "${wxWidgets_USE_LIBS}") STRING(REGEX REPLACE ";" "," wxWidgets_USE_LIBS "${wxWidgets_USE_LIBS}") - EXEC_PROGRAM(${wxWidgets_CONFIG_EXECUTABLE} - ARGS "--libs ${wxWidgets_USE_LIBS}" + EXEC_PROGRAM(sh + ARGS "${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_USE_LIBS}" OUTPUT_VARIABLE wxWidgets_LIBRARIES RETURN_VALUE RET) IF(RET EQUAL 0) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 8d431bf..4ffdb1b 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -17,9 +17,20 @@ IF(MSVC) ) ENDIF(MSVC71) IF(MSVC80) + # Find the runtime library redistribution directory. + FIND_PATH(MSVC80_REDIST_DIR NAMES x86/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/redist" + ) + MARK_AS_ADVANCED(MSVC80_REDIST_DIR) + SET(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/x86/Microsoft.VC80.CRT") + + # Install the manifest that allows DLLs to be loaded from the + # directory containing the executable. SET(__install__libs - "${SYSTEMROOT}/system32/msvcp80.dll" - "${SYSTEMROOT}/system32/msvcr80.dll" + "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest" + "${MSVC80_CRT_DIR}/msvcm80.dll" + "${MSVC80_CRT_DIR}/msvcp80.dll" + "${MSVC80_CRT_DIR}/msvcr80.dll" ) ENDIF(MSVC80) IF(CMAKE_INSTALL_MFC_LIBRARIES) @@ -34,8 +45,12 @@ IF(MSVC) ) ENDIF(MSVC71) IF(MSVC80) + SET(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/x86/Microsoft.VC80.MFC") + # Install the manifest that allows DLLs to be loaded from the + # directory containing the executable. SET(__install__libs ${__install__libs} - "${SYSTEMROOT}/system32/mfc80.dll" + "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest" + "${MSVC80_MFC_DIR}/mfc80.dll" ) ENDIF(MSVC80) ENDIF(CMAKE_INSTALL_MFC_LIBRARIES) diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake index 0c2ae19..6866fe2 100644 --- a/Modules/KDE3Macros.cmake +++ b/Modules/KDE3Macros.cmake @@ -1,4 +1,4 @@ - +# # See FindKDE3.cmake for documentation. # @@ -36,9 +36,10 @@ MACRO(KDE3_ADD_DCOP_SKELS _sources) ADD_CUSTOM_COMMAND(OUTPUT ${_kidl} COMMAND ${KDE3_DCOPIDL_EXECUTABLE} - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} > ${_kidl} + ARGS ${_tmp_FILE} > ${_kidl} DEPENDS ${_tmp_FILE} ) + ENDIF (NOT HAVE_${_basename}_KIDL_RULE) IF (NOT HAVE_${_basename}_SKEL_RULE) @@ -75,8 +76,8 @@ MACRO(KDE3_ADD_DCOP_STUBS _sources) ADD_CUSTOM_COMMAND(OUTPUT ${_kidl} COMMAND ${KDE3_DCOPIDL_EXECUTABLE} - ARGS ${tmp_FILE} > ${_kidl} - DEPENDS ${tmp_FILE} + ARGS ${_tmp_FILE} > ${_kidl} + DEPENDS ${_tmp_FILE} ) ENDIF (NOT HAVE_${_basename}_KIDL_RULE) @@ -163,13 +164,14 @@ MACRO(KDE3_ADD_UI_FILES _sources ) ADD_CUSTOM_COMMAND(OUTPUT ${_header} COMMAND ${QT_UIC_EXECUTABLE} - ARGS -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} + ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} DEPENDS ${_tmp_FILE} ) ADD_CUSTOM_COMMAND(OUTPUT ${_src} COMMAND ${CMAKE_COMMAND} ARGS + -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE} -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} -DKDE_UIC_CPP_FILE:FILEPATH=${_src} @@ -236,49 +238,64 @@ MACRO(KDE3_AUTOMOC) ENDFOREACH (_current_FILE) ENDMACRO(KDE3_AUTOMOC) +# only used internally by KDE3_INSTALL_ICONS +MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME) -MACRO(KDE3_INSTALL_ICONS _theme) - ADD_CUSTOM_TARGET(install_icons ) - SET_TARGET_PROPERTIES(install_icons PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake ) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "# icon installations rules\n") - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "SET(CMAKE_BACKWARDS_COMPATIBILITY \"2.2\") \n") - - FILE(GLOB _icons *.png) - FOREACH(_current_ICON ${_icons} ) - STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") - STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") - STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") - + # if the string doesn't match the pattern, the result is the full string, so all three have the same content + IF (NOT ${_group} STREQUAL ${_install_NAME} ) SET(_icon_GROUP "actions") - IF(${_group} STREQUAL "mime") + IF (${_group} STREQUAL "mime") SET(_icon_GROUP "mimetypes") - ENDIF(${_group} STREQUAL "mime") + ENDIF (${_group} STREQUAL "mime") - IF(${_group} STREQUAL "filesys") + IF (${_group} STREQUAL "filesys") SET(_icon_GROUP "filesystems") - ENDIF(${_group} STREQUAL "filesys") + ENDIF (${_group} STREQUAL "filesys") - IF(${_group} STREQUAL "device") + IF (${_group} STREQUAL "device") SET(_icon_GROUP "devices") - ENDIF(${_group} STREQUAL "device") + ENDIF (${_group} STREQUAL "device") - IF(${_group} STREQUAL "app") + IF (${_group} STREQUAL "app") SET(_icon_GROUP "apps") - ENDIF(${_group} STREQUAL "app") + ENDIF (${_group} STREQUAL "app") - IF(${_group} STREQUAL "action") + IF (${_group} STREQUAL "action") SET(_icon_GROUP "actions") - ENDIF(${_group} STREQUAL "action") + ENDIF (${_group} STREQUAL "action") # message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" ) - SET(_ICON_INSTALL_NAME ${CMAKE_INSTALL_PREFIX}/share/icons/${_theme}/${_size}x${_size}/${_icon_GROUP}/${_name}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "message(STATUS \"Installing ${_ICON_INSTALL_NAME}\") \n") - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "CONFIGURE_FILE( ${_current_ICON} ${_ICON_INSTALL_NAME} COPYONLY) \n") + INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) + ENDIF (NOT ${_group} STREQUAL ${_install_NAME} ) + +ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE) + + +MACRO (KDE3_INSTALL_ICONS _theme ) + SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons") + # first the png icons + FILE(GLOB _icons *.png) + FOREACH (_current_ICON ${_icons} ) + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") + _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme}/${_size}x${_size} + ${_group} ${_current_ICON} ${_name}) + ENDFOREACH (_current_ICON) + # and now the svg icons + FILE(GLOB _icons *.svgz) + FOREACH (_current_ICON ${_icons} ) + STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") + _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme}/scalable + ${_group} ${_current_ICON} ${_name}) ENDFOREACH (_current_ICON) -ENDMACRO(KDE3_INSTALL_ICONS) +ENDMACRO (KDE3_INSTALL_ICONS) MACRO(KDE3_INSTALL_LIBTOOL_FILE _target) GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake index be02529..b83a9b6 100644 --- a/Modules/Platform/AIX.cmake +++ b/Modules/Platform/AIX.cmake @@ -31,3 +31,27 @@ ELSE(CMAKE_COMPILER_IS_GNUCC) SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG") SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g") ENDIF(CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) + + +# since .a can be a static or shared library on AIX, we can not do this. +# at some point if we wanted it, we would have to figure out if a .a is +# static or shared, then we could add this back: + +# Initialize C 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. +#FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) +# SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic") +# SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic") +#ENDFOREACH(type) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index c7ccd98..fe34bfc 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -27,4 +27,17 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>") + +# Shared libraries on cygwin can be named with their version number. +SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) + +# Initialize C 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. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +ENDFOREACH(type) + INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 884690a..e26c6f2 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -45,8 +45,15 @@ IF(NOT XCODE) # soname computation. SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") + SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") ENDIF(NOT XCODE) +# Xcode does not support -isystem yet. +IF(XCODE) + SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) + SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +ENDIF(XCODE) + SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>") SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) @@ -55,6 +62,8 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") @@ -62,6 +71,10 @@ SET(CMAKE_CXX_CREATE_SHARED_MODULE SET(CMAKE_C_CREATE_SHARED_MODULE "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_Fortran_CREATE_SHARED_MODULE + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + + SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES /usr/local/include) # default to searching for frameworks first diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index 7ce5345..3970acf 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -8,4 +8,14 @@ IF(EXISTS /usr/include/dlfcn.h) SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") ENDIF(EXISTS /usr/include/dlfcn.h) + +# Initialize C 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. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +ENDFOREACH(type) + INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 8c149ed..f7fd3f0 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -71,3 +71,36 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_COMPILER_IS_GNUCXX) # set flags for gcc support INCLUDE(Platform/UnixPaths) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) + +# 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(type) +FOREACH(type EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") +ENDFOREACH(type) +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") +ENDFOREACH(type) + diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake index 776bb4a..5452280 100644 --- a/Modules/Platform/IRIX.cmake +++ b/Modules/Platform/IRIX.cmake @@ -15,3 +15,19 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX) ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) # set flags for gcc support INCLUDE(Platform/UnixPaths) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index fbd35a6..1229947 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -44,3 +44,19 @@ IF(NOT CMAKE_COMPILER_IS_GNUCC) SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) INCLUDE(Platform/UnixPaths) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index 6ae2ed5..498e491 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -7,4 +7,15 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") +SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,") + +# Initialize C 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. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +ENDFOREACH(type) + INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 740aff7..e85b571 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,6 +1,10 @@ # GCC is the default compiler on QNX 6.3. INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) +# The QNX GCC does not seem to have -isystem so remove the flag. +SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) +SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) + SET(CMAKE_DL_LIBS "") SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") @@ -9,3 +13,12 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") + +# Initialize C 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. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +ENDFOREACH(type) diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 0d3f183..aa1e933 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -61,3 +61,40 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_CXX_COMPILER) ENDIF(CMAKE_COMPILER_IS_GNUCXX) INCLUDE(Platform/UnixPaths) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) + +# Initialize C 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. +IF(CMAKE_COMPILER_IS_GNUCC) + FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") + ENDFOREACH(type) +ELSE(CMAKE_COMPILER_IS_GNUCC) + FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") + ENDFOREACH(type) +ENDIF(CMAKE_COMPILER_IS_GNUCC) +IF(CMAKE_COMPILER_IS_GNUCXX) + FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bdynamic") + ENDFOREACH(type) +ELSE(CMAKE_COMPILER_IS_GNUCXX) + FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") + ENDFOREACH(type) +ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 5515a30..b6232e9 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -1,6 +1,32 @@ -SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /usr/include - /usr/local/include /usr/local /opt/local/include /usr/X11R6/include /usr/include/X11 /usr/pkg/include) -SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /lib /usr/lib /usr/local/lib - /usr/lib/w32api /usr/X11R6/lib /opt/local/lib /opt/csw/lib /opt/lib /usr/pkg/lib) -SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} /bin /usr/bin /usr/local/bin - /usr/pkg/bin /sbin) +SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} + # Standard + /include /usr/include /usr/local/include + + # Windows API on Cygwin + /usr/include/w32api + + # X11 + /usr/X11R6/include /usr/include/X11 + + # Other + /opt/local/include /usr/pkg/include + ) + +SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} + # Standard + /lib /usr/lib /usr/local/lib + + # Windows API on Cygwin + /usr/lib/w32api + + # X11 + /usr/X11R6/lib /usr/lib/X11 + + # Other + /opt/local/lib /usr/pkg/lib + /opt/csw/lib /opt/lib + ) + +SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} + /bin /usr/bin /usr/local/bin /usr/pkg/bin /sbin + ) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index ba306ad..0005aa4 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -24,7 +24,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_LIBRARY}") # create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "link /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") # create a C static library SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}") @@ -44,6 +44,18 @@ SET(CMAKE_C_LINK_EXECUTABLE SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> /Fd<TARGET_PDB> -link <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") +SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE + "<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE + "<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) @@ -198,16 +210,20 @@ ENDIF(CMAKE_FORCE_WIN64) IF(MSVC80) # for 2005 make sure the manifest is put in the dll with mt SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}" - "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2") + "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\"" + ) SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared library SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared module just copy the shared library rule SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_LIBRARY}") SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}" - "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2") + "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\"" + ) SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}" - "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2") + "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\"" + ) + SET(CMAKE_BUILD_TYPE_INIT Debug) SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") @@ -220,6 +236,7 @@ IF(MSVC80) SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") ELSE(MSVC80) IF(CMAKE_USING_VC_FREE_TOOLS) MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") @@ -257,9 +274,11 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") # set the stack size and the machine type IF(CMAKE_CL_64) - SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:x64") + SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:x64") ELSE(CMAKE_CL_64) - SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386") + SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:I386") ENDIF(CMAKE_CL_64) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp diff --git a/Modules/Platform/Windows-gcc.cmake b/Modules/Platform/Windows-gcc.cmake index b3bf19f..a5152b3 100644 --- a/Modules/Platform/Windows-gcc.cmake +++ b/Modules/Platform/Windows-gcc.cmake @@ -34,3 +34,14 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>") + +# Initialize C 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. +IF(MSYS OR MINGW) + FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") + ENDFOREACH(type) +ENDIF(MSYS OR MINGW) diff --git a/Modules/Platform/gcc.cmake b/Modules/Platform/gcc.cmake index 6543f5c..7d3235b 100644 --- a/Modules/Platform/gcc.cmake +++ b/Modules/Platform/gcc.cmake @@ -4,6 +4,9 @@ IF(CMAKE_COMPILER_IS_GNUCC) SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + SET (CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") ENDIF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCXX) @@ -12,5 +15,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX) SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index a61c484..7979831 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -1,10 +1,13 @@ # - This module defines variables and macros required to build eCos application. # This file contains the following macros: # ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs +# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos executable +# ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts the path of the source files and puts the result into VAR +# +# Macros for selecting the toolchain: # ECOS_USE_ARM_ELF_TOOLS() - enable the ARM ELF toolchain for the directory where it is called +# ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the directory where it is called # ECOS_USE_PPC_EABI_TOOLS() - enable the PowerPC toolchain for the directory where it is called -# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an executable for eCos -# ECOS_ADJUST_DIRECTORY(source1 ... sourceN ) # # It contains the following variables: # ECOS_DEFINITIONS @@ -78,6 +81,21 @@ MACRO (ECOS_USE_PPC_EABI_TOOLS) SET(ECOS_ARCH_PREFIX "powerpc-eabi-") ENDMACRO (ECOS_USE_PPC_EABI_TOOLS) +#usage: ECOS_USE_I386_ELF_TOOLS() +MACRO (ECOS_USE_I386_ELF_TOOLS) + SET(CMAKE_CXX_COMPILER "i386-elf-c++") + SET(CMAKE_COMPILER_IS_GNUCXX 1) + SET(CMAKE_C_COMPILER "i386-elf-gcc") + SET(CMAKE_AR "i386-elf-ar") + SET(CMAKE_RANLIB "i386-elf-ranlib") +#for linking + SET(ECOS_LD_MCPU "") +#for compiling + ADD_DEFINITIONS() +#for the obj-tools + SET(ECOS_ARCH_PREFIX "i386-elf-") +ENDMACRO (ECOS_USE_I386_ELF_TOOLS) + #since the actual sources are located one level upwards #a "../" has to be prepended in front of every source file @@ -150,20 +168,14 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") ADD_EXECUTABLE(${_exe_NAME} ${ARGN}) - -#under win32 the ".exe" suffix is appended to the binary name, copy it so that it exists also without the prefix -#otherwise the following custom commands don't work - IF(WIN32) - ADD_CUSTOM_COMMAND(TARGET ${_exe_NAME} POST_BUILD COMMAND cp ARGS ${_exe_NAME}.exe ${_exe_NAME}_ ) - ADD_CUSTOM_COMMAND(TARGET ${_exe_NAME} POST_BUILD COMMAND mv ARGS ${_exe_NAME}_ ${_exe_NAME} ) - ENDIF(WIN32) + SET_TARGET_PROPERTIES(${_exe_NAME} PROPERTIES SUFFIX ".elf") #create a binary file ADD_CUSTOM_COMMAND( TARGET ${_exe_NAME} POST_BUILD COMMAND ${ECOS_ARCH_PREFIX}objcopy - ARGS -O binary ${_exe_NAME} ${_exe_NAME}.bin + ARGS -O binary ${_exe_NAME}.elf ${_exe_NAME}.bin ) #and an srec file @@ -171,11 +183,11 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) TARGET ${_exe_NAME} POST_BUILD COMMAND ${ECOS_ARCH_PREFIX}objcopy - ARGS -O srec ${_exe_NAME} ${_exe_NAME}.srec + ARGS -O srec ${_exe_NAME}.elf ${_exe_NAME}.srec ) #add the created files to the make_clean_files - SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};${_exe_NAME};${_exe_NAME}.bin;${_exe_NAME}.srec;${_exe_NAME}.lst;) + SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};${_exe_NAME}.bin;${_exe_NAME}.srec;${_exe_NAME}.lst;) SET_DIRECTORY_PROPERTIES( PROPERTIES @@ -192,11 +204,11 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) ADD_CUSTOM_TARGET( listing COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${_exe_NAME}.lst - COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${_exe_NAME} >> ${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${_exe_NAME}.elf >> ${_exe_NAME}.lst COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${_exe_NAME}.lst - COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${_exe_NAME} >> ${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${_exe_NAME}.elf >> ${_exe_NAME}.lst COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${_exe_NAME}.lst - COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${_exe_NAME} >> ${_exe_NAME}.lst ) + COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${_exe_NAME}.elf >> ${_exe_NAME}.lst ) ENDMACRO(ECOS_ADD_EXECUTABLE) diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index 62a1edf..938edb6 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -10,209 +10,82 @@ INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}) SET(QT_LIBRARIES "") -IF (NOT QT_DONT_USE_QTCORE) - IF (QT_QTCORE_FOUND) - INCLUDE_DIRECTORIES(${QT_QTCORE_INCLUDE_DIR}) - ADD_DEFINITIONS(-DQT_CORE_LIB) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTCORE_LIBRARY}" - debug "${QT_QTCORE_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTCORE_LIBRARY}" ) - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - IF (UNIX) - IF (CMAKE_DL_LIBS) - SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS}) - ENDIF (CMAKE_DL_LIBS) - ENDIF (UNIX) - ELSE (QT_QTCORE_FOUND) - MESSAGE("QtCore library not found.") - ENDIF (QT_QTCORE_FOUND) -ENDIF (NOT QT_DONT_USE_QTCORE) +IF (QT_USE_QTMAIN) + IF (WIN32) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) + ENDIF (WIN32) +ENDIF (QT_USE_QTMAIN) -IF (NOT QT_DONT_USE_QTGUI) - IF (QT_QTGUI_FOUND) - INCLUDE_DIRECTORIES(${QT_QTGUI_INCLUDE_DIR}) - ADD_DEFINITIONS(-DQT_GUI_LIB) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTGUI_LIBRARY}" - debug "${QT_QTGUI_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTGUI_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - IF (UNIX) - IF (X11_FOUND) - SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES}) - ENDIF (X11_FOUND) - ENDIF (UNIX) - ELSE (QT_QTGUI_FOUND) - MESSAGE("QtGui library not found.") - ENDIF (QT_QTGUI_FOUND) -ENDIF (NOT QT_DONT_USE_QTGUI) +# Macro for setting up compile flags for Qt modules +MACRO(QT_MODULE_SETUP module) + IF (QT_QT${module}_FOUND) + ADD_DEFINITIONS(-DQT_${module}_LIB) + INCLUDE_DIRECTORIES(${QT_QT${module}_INCLUDE_DIR}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT${module}_LIBRARY}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES}) + ELSE (QT_QT${module}_FOUND) + MESSAGE("Qt ${module} library not found.") + ENDIF (QT_QT${module}_FOUND) +ENDMACRO(QT_MODULE_SETUP) + + +# Qt modules (in order of dependence) IF (QT_USE_QT3SUPPORT) - IF (QT_QT3SUPPORT_FOUND) - INCLUDE_DIRECTORIES(${QT_QT3SUPPORT_INCLUDE_DIR}) + QT_MODULE_SETUP(3SUPPORT) ADD_DEFINITIONS(-DQT3_SUPPORT) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QT3SUPPORT_LIBRARY}" - debug "${QT_QT3SUPPORT_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QT3SUPPORT_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QT3SUPPORT_FOUND) - MESSAGE("Qt3Support library not found.") - ENDIF (QT_QT3SUPPORT_FOUND) ENDIF (QT_USE_QT3SUPPORT) +IF (QT_USE_QTOPENGL) + QT_MODULE_SETUP(OPENGL) +ENDIF (QT_USE_QTOPENGL) + IF (QT_USE_QTASSISTANT) - IF (QT_QTASSISTANT_FOUND) - INCLUDE_DIRECTORIES(${QT_QTASSISTANT_INCLUDE_DIR}) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTASSISTANT_LIBRARY}" - debug "${QT_QTASSISTANT_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTASSISTANT_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTASSISTANT_FOUND) - MESSAGE("QtAssistant library not found.") - ENDIF (QT_QTASSISTANT_FOUND) + QT_MODULE_SETUP(ASSISTANT) ENDIF (QT_USE_QTASSISTANT) IF (QT_USE_QTDESIGNER) - IF (QT_QTDESIGNER_FOUND) - INCLUDE_DIRECTORIES(${QT_QTDESIGNER_INCLUDE_DIR}) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTDESIGNER_LIBRARY}" - debug "${QT_QTDESIGNER_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTDESIGNER_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTDESIGNER_FOUND) - MESSAGE("QtDesigner library not found.") - ENDIF (QT_QTDESIGNER_FOUND) + QT_MODULE_SETUP(DESIGNER) ENDIF (QT_USE_QTDESIGNER) -IF (QT_USE_QTMAIN) - IF (WIN32) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTMAIN_LIBRARY}" - debug "${QT_QTMAIN_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTMAIN_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ENDIF (WIN32) -ENDIF (QT_USE_QTMAIN) - IF (QT_USE_QTMOTIF) - IF (QT_QTMOTIF_FOUND) - INCLUDE_DIRECTORIES(${QT_QTMOTIF_INCLUDE_DIR}) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTMOTIF_LIBRARY}" - debug "${QT_QTMOTIF_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTMOTIF_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTMOTIF_FOUND) - MESSAGE("QtMotif library not found.") - ENDIF (QT_QTMOTIF_FOUND) + QT_MODULE_SETUP(MOTIF) ENDIF (QT_USE_QTMOTIF) -IF (QT_USE_QTNETWORK) - IF (QT_QTNETWORK_FOUND) - INCLUDE_DIRECTORIES(${QT_QTNETWORK_INCLUDE_DIR}) - ADD_DEFINITIONS(-DQT_NETWORK_LIB) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTNETWORK_LIBRARY}" - debug "${QT_QTNETWORK_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTNETWORK_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTNETWORK_FOUND) - MESSAGE("QtNetwork library not found.") - ENDIF (QT_QTNETWORK_FOUND) -ENDIF (QT_USE_QTNETWORK) - IF (QT_USE_QTNSPLUGIN) - IF (QT_QTNSPLUGIN_FOUND) - INCLUDE_DIRECTORIES(${QT_QTNSPLUGIN_INCLUDE_DIR}) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTNSPLUGIN_LIBRARY}" - debug "${QT_QTNSPLUGIN_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTNSPLUGIN_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTNSPLUGIN_FOUND) - MESSAGE("QtNsPlugin library not found.") - ENDIF (QT_QTNSPLUGIN_FOUND) + QT_MODULE_SETUP(NSPLUGIN) ENDIF (QT_USE_QTNSPLUGIN) -IF (QT_USE_QTOPENGL) - IF (QT_QTOPENGL_FOUND) - INCLUDE_DIRECTORIES(${QT_QTOPENGL_INCLUDE_DIR}) - ADD_DEFINITIONS(-DQT_OPENGL_LIB) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTOPENGL_LIBRARY}" - debug "${QT_QTOPENGL_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTOPENGL_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTOPENGL_FOUND) - MESSAGE("QtOpenGL library not found.") - ENDIF (QT_QTOPENGL_FOUND) -ENDIF (QT_USE_QTOPENGL) +IF (QT_USE_QTSVG) + QT_MODULE_SETUP(SVG) +ENDIF (QT_USE_QTSVG) -IF (QT_USE_QTSQL) - IF (QT_QTSQL_FOUND) - INCLUDE_DIRECTORIES(${QT_QTSQL_INCLUDE_DIR}) - ADD_DEFINITIONS(-DQT_SQL_LIB) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTSQL_LIBRARY}" - debug "${QT_QTSQL_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTSQL_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTSQL_FOUND) - MESSAGE("QtSql library not found.") - ENDIF (QT_QTSQL_FOUND) -ENDIF (QT_USE_QTSQL) +IF (QT_USE_QTUITOOLS) + QT_MODULE_SETUP(UITOOLS) +ENDIF (QT_USE_QTUITOOLS) + +IF (NOT QT_DONT_USE_QTGUI) + QT_MODULE_SETUP(GUI) +ENDIF (NOT QT_DONT_USE_QTGUI) + +IF (QT_USE_QTTEST) + QT_MODULE_SETUP(TEST) +ENDIF (QT_USE_QTTEST) IF (QT_USE_QTXML) - IF (QT_QTXML_FOUND) - INCLUDE_DIRECTORIES(${QT_QTXML_INCLUDE_DIR}) - ADD_DEFINITIONS(-DQT_XML_LIB) - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} - optimized "${QT_QTXML_LIBRARY}" - debug "${QT_QTXML_LIBRARY_DEBUG}" - ) - ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTXML_LIBRARY}") - ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QT_QTXML_FOUND) - MESSAGE("QtXml library not found.") - ENDIF (QT_QTXML_FOUND) + QT_MODULE_SETUP(XML) ENDIF (QT_USE_QTXML) +IF (QT_USE_QTSQL) + QT_MODULE_SETUP(SQL) +ENDIF (QT_USE_QTSQL) + +IF (QT_USE_QTNETWORK) + QT_MODULE_SETUP(NETWORK) +ENDIF (QT_USE_QTNETWORK) + +IF (NOT QT_DONT_USE_QTCORE) + QT_MODULE_SETUP(CORE) +ENDIF (NOT QT_DONT_USE_QTCORE) + + diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b107d6c..fee83a5 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -12,6 +12,8 @@ # special flags to all swig calls. # Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify # where to write all the swig generated module (swig -outdir option) +# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used +# to specify extra dependencies for the generated modules. SET(SWIG_CXX_EXTENSION "cxx") SET(SWIG_EXTRA_LIBRARIES "") @@ -145,6 +147,7 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) -o "${swig_generated_file_fullname}" "${swig_source_file_fullname}" MAIN_DEPENDENCY "${swig_source_file_fullname}" + DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} COMMENT "Swig source") ELSE(CMAKE_SWIG_OUTDIR) ADD_CUSTOM_COMMAND( @@ -160,6 +163,7 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) -o "${swig_generated_file_fullname}" "${swig_source_file_fullname}" MAIN_DEPENDENCY "${swig_source_file_fullname}" + DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} COMMENT "Swig source") ENDIF(CMAKE_SWIG_OUTDIR) SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}" diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake index f41b2a3..0dbbbcf 100644 --- a/Modules/kde3uic.cmake +++ b/Modules/kde3uic.cmake @@ -5,7 +5,7 @@ EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE} - -nounload -tr tr2i18n + -L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n -impl ${KDE_UIC_H_FILE} ${KDE_UIC_FILE} OUTPUT_VARIABLE _uic_CONTENTS diff --git a/Modules/readme.txt b/Modules/readme.txt index b9bd805..4c31b6b 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -16,7 +16,7 @@ XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command. XXX_YY_FOUND If False, optional YY part of XXX sytem is not available. XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX. -You do not have to provide all of the above variables. You should provide XXX_FOUND under most circumstances. If XXX is a library, then XXX_LIBRARIES, should also be defined, and XXX_INCLUDE_DIR should usually be defined (I guess libm.a might be an exception) +You do not have to provide all of the above variables. You should provide XXX_FOUND under most circumstances. If XXX is a library, then XXX_LIBRARIES, should also be defined, and XXX_INCLUDE_DIRS should usually be defined (I guess libm.a might be an exception) The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in users' CMake Caches to control stuff. |