Merge branch 'master' into sublime-text-2-generator

Resolve conflict in Source/cmDocumentVariables.cxx by adding both
variables.
This commit is contained in:
Robert Maynard 2013-01-23 14:50:00 -05:00 committed by Brad King
commit badb40d0f8
277 changed files with 7123 additions and 3163 deletions

View File

@ -51,3 +51,27 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr") set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
endif() endif()
endif() endif()
if("${CPACK_GENERATOR}" STREQUAL "WIX")
# Reset CPACK_PACKAGE_VERSION to deal with WiX restriction.
# But the file names still use the full CMake_VERSION value:
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-@CMake_VERSION@-${CPACK_SYSTEM_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-@CMake_VERSION@-Source")
if(NOT CPACK_WIX_SIZEOF_VOID_P)
set(CPACK_WIX_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
endif()
set(CPACK_PACKAGE_VERSION
"@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@")
# WIX installers require at most a 4 component version number, where
# each component is an integer between 0 and 65534 inclusive
set(tweak "@CMake_VERSION_TWEAK@")
if(tweak MATCHES "^[0-9]+$")
if(tweak GREATER 0 AND tweak LESS 65535)
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${tweak}")
endif()
endif()
endif()

View File

@ -234,8 +234,6 @@ macro (CMAKE_BUILD_UTILITIES)
set(kwsys_folder "Utilities/KWSys") set(kwsys_folder "Utilities/KWSys")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}EncodeExecutable "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}ProcessFwd9x "${kwsys_folder}")
if(BUILD_TESTING) if(BUILD_TESTING)
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
@ -590,10 +588,10 @@ if(NOT CMake_VERSION_IS_RELEASE)
NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
-Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
-Wmissing-format-attribute -fno-common -Wmissing-format-attribute -fno-common -Wundef
) )
set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
-Wshadow -Wpointer-arith -Wformat-security -Wshadow -Wpointer-arith -Wformat-security -Wundef
) )
foreach(FLAG_LANG C CXX) foreach(FLAG_LANG C CXX)

View File

@ -1,3 +1,17 @@
Changes in CMake 2.8.10.2 (since 2.8.10.1)
----------------------------------------------
Alex Neundorf (1):
Automoc: fix regression #13667, broken build in phonon
Brad King (1):
Initialize IMPORTED GLOBAL targets on reconfigure (#13702)
David Cole (1):
CMake: Fix infinite loop untarring corrupt tar file
Rolf Eike Beer (1):
FindGettext: fix overwriting result with empty variable (#13691)
Changes in CMake 2.8.10.1 (since 2.8.10) Changes in CMake 2.8.10.1 (since 2.8.10)
---------------------------------------------- ----------------------------------------------
Brad King (5): Brad King (5):

View File

@ -50,6 +50,7 @@ endif()
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
@SET_CMAKE_CMCLDEPS_EXECUTABLE@ @SET_CMAKE_CMCLDEPS_EXECUTABLE@
@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@ @SET_CMAKE_CL_SHOWINCLUDE_PREFIX@

View File

@ -51,6 +51,7 @@ endif()
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
@SET_CMAKE_CMCLDEPS_EXECUTABLE@ @SET_CMAKE_CMCLDEPS_EXECUTABLE@
@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@ @SET_CMAKE_CL_SHOWINCLUDE_PREFIX@

View File

@ -72,19 +72,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# Parse implicit linker information for this language, if available. # Parse implicit linker information for this language, if available.
set(implicit_dirs "") set(implicit_dirs "")
set(implicit_libs "") set(implicit_libs "")
set(MULTI_ARCH FALSE) set(implicit_fwks "")
if(DEFINED CMAKE_OSX_ARCHITECTURES) if(CMAKE_${lang}_VERBOSE_FLAG)
if( "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" ) CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
set(MULTI_ARCH TRUE)
endif()
endif()
if(CMAKE_${lang}_VERBOSE_FLAG
# Implicit link information cannot be used explicitly for
# multiple OS X architectures, so we skip it.
AND NOT MULTI_ARCH
# Skip this with Xcode for now.
AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode)
CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log
"${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}") "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Parsed ${lang} implicit link information from above output:\n${log}\n\n") "Parsed ${lang} implicit link information from above output:\n${log}\n\n")
@ -112,8 +102,17 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
message(STATUS "${_desc}") message(STATUS "${_desc}")
endif() endif()
# Implicit link libraries cannot be used explicitly for multiple
# OS X architectures, so we skip it.
if(DEFINED CMAKE_OSX_ARCHITECTURES)
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";")
set(implicit_libs "")
endif()
endif()
set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
# Detect library architecture directory name. # Detect library architecture directory name.
if(CMAKE_LIBRARY_ARCHITECTURE_REGEX) if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)

View File

@ -107,11 +107,14 @@ Id flags: ${testflags}
") ")
# Compile the compiler identification source. # Compile the compiler identification source.
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?") if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
set(vs_version ${CMAKE_MATCH_1}) set(vs_version ${CMAKE_MATCH_1})
set(vs_arch ${CMAKE_MATCH_4}) set(id_arch ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}") set(id_lang "${lang}")
set(id_cl cl.exe) set(id_cl cl.exe)
if(NOT id_arch)
set(id_arch Win32)
endif()
if(NOT "${vs_version}" VERSION_LESS 10) if(NOT "${vs_version}" VERSION_LESS 10)
set(v 10) set(v 10)
set(ext vcxproj) set(ext vcxproj)
@ -123,25 +126,26 @@ Id flags: ${testflags}
set(v 6) set(v 6)
set(ext dsp) set(ext dsp)
endif() endif()
if("${vs_arch}" STREQUAL "Win64") if("${id_arch}" STREQUAL "x64")
set(id_machine_7 17)
set(id_machine_10 MachineX64) set(id_machine_10 MachineX64)
set(id_arch x64) elseif("${id_arch}" STREQUAL "Itanium")
elseif("${vs_arch}" STREQUAL "IA64")
set(id_machine_7 5)
set(id_machine_10 MachineIA64) set(id_machine_10 MachineIA64)
set(id_arch ia64) set(id_arch ia64)
else() else()
set(id_machine_6 x86) set(id_machine_6 x86)
set(id_machine_7 1)
set(id_machine_10 MachineX86) set(id_machine_10 MachineX86)
set(id_arch Win32)
endif() endif()
if(CMAKE_VS_PLATFORM_TOOLSET) if(CMAKE_VS_PLATFORM_TOOLSET)
set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
else() else()
set(id_toolset "") set(id_toolset "")
endif() endif()
if(CMAKE_VS_WINCE_VERSION)
set(id_entrypoint "mainACRTStartup")
set(id_subsystem 9)
else()
set(id_subsystem 1)
endif()
if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]") if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0) set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0)
elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]") elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")

View File

@ -63,6 +63,8 @@ if(NOT CMAKE_Java_COMPILER)
/usr/java/j2sdk1.4.2_09/bin /usr/java/j2sdk1.4.2_09/bin
/usr/lib/j2sdk1.5-sun/bin /usr/lib/j2sdk1.5-sun/bin
/opt/sun-jdk-1.5.0.04/bin /opt/sun-jdk-1.5.0.04/bin
/usr/local/jdk-1.7.0/bin
/usr/local/jdk-1.6.0/bin
) )
# if no compiler has been specified yet, then look for one # if no compiler has been specified yet, then look for one
if(CMAKE_Java_COMPILER_INIT) if(CMAKE_Java_COMPILER_INIT)

View File

@ -106,6 +106,12 @@ if(CMAKE_SYSTEM_NAME)
set(CMAKE_CROSSCOMPILING TRUE) set(CMAKE_CROSSCOMPILING TRUE)
endif() endif()
set(PRESET_CMAKE_SYSTEM_NAME TRUE) set(PRESET_CMAKE_SYSTEM_NAME TRUE)
elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_NAME "WindowsCE")
set(CMAKE_SYSTEM_VERSION "${CMAKE_VS_WINCE_VERSION}")
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else() else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")

View File

@ -52,3 +52,4 @@ endif()
set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")

View File

@ -74,12 +74,8 @@
PRINT *, 'INFO:platform[IRIX]' PRINT *, 'INFO:platform[IRIX]'
#elif defined(__hpux) || defined(__hpux__) #elif defined(__hpux) || defined(__hpux__)
PRINT *, 'INFO:platform[HP-UX]' PRINT *, 'INFO:platform[HP-UX]'
#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) #elif defined(__HAIKU__)
PRINT *, 'INFO:platform[Haiku]' PRINT *, 'INFO:platform[Haiku]'
# if 0
! Haiku also defines __BEOS__ so we must
! put it prior to the check for __BEOS__
# endif
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
PRINT *, 'INFO:platform[BeOS]' PRINT *, 'INFO:platform[BeOS]'
#elif defined(__QNX__) || defined(__QNXNTO__) #elif defined(__QNX__) || defined(__QNXNTO__)

View File

@ -188,8 +188,13 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
endif() endif()
endforeach() endforeach()
get_filename_component(inputFileName "${_inputFile}" NAME)
set(PACKAGE_INIT " set(PACKAGE_INIT "
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was ${inputFileName} ########
get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
") ")

View File

@ -16,9 +16,10 @@
# This is used internally by CMake and should not be included by user # This is used internally by CMake and should not be included by user
# code. # code.
function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex)
set(implicit_libs_tmp "") set(implicit_libs_tmp "")
set(implicit_dirs_tmp) set(implicit_dirs_tmp)
set(implicit_fwks_tmp)
set(log "") set(log "")
# Parse implicit linker arguments. # Parse implicit linker arguments.
@ -36,6 +37,16 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
set(cmd) set(cmd)
if("${line}" MATCHES "${linker_regex}" AND if("${line}" MATCHES "${linker_regex}" AND
NOT "${line}" MATCHES "${linker_exclude_regex}") NOT "${line}" MATCHES "${linker_exclude_regex}")
if(XCODE)
# Xcode unconditionally adds a path under the project build tree and
# on older versions it is not reported with proper quotes. Remove it.
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _dir_regex "${CMAKE_BINARY_DIR}")
string(REGEX REPLACE " -[FL]${_dir_regex}/([^ ]| [^-])+( |$)" " " xline "${line}")
if(NOT "x${xline}" STREQUAL "x${line}")
set(log "${log} reduced line: [${line}]\n to: [${xline}]\n")
set(line "${xline}")
endif()
endif()
if(UNIX) if(UNIX)
separate_arguments(args UNIX_COMMAND "${line}") separate_arguments(args UNIX_COMMAND "${line}")
else() else()
@ -97,6 +108,18 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
endif() endif()
endforeach() endforeach()
# Look for library search paths reported by linker.
if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}")
set(log "${log} Library search paths: [${implicit_dirs_match}]\n")
list(APPEND implicit_dirs_tmp ${implicit_dirs_match})
endif()
if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}")
set(log "${log} Framework search paths: [${implicit_fwks_match}]\n")
list(APPEND implicit_fwks_tmp ${implicit_fwks_match})
endif()
# Cleanup list of libraries and flags. # Cleanup list of libraries and flags.
# We remove items that are not language-specific. # We remove items that are not language-specific.
set(implicit_libs "") set(implicit_libs "")
@ -108,21 +131,33 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
endif() endif()
endforeach() endforeach()
# Cleanup list of directories. # Cleanup list of library and framework directories.
set(implicit_dirs "") set(desc_dirs "library")
foreach(d IN LISTS implicit_dirs_tmp) set(desc_fwks "framework")
get_filename_component(dir "${d}" ABSOLUTE) foreach(t dirs fwks)
list(APPEND implicit_dirs "${dir}") set(implicit_${t} "")
set(log "${log} collapse dir [${d}] ==> [${dir}]\n") foreach(d IN LISTS implicit_${t}_tmp)
get_filename_component(dir "${d}" ABSOLUTE)
string(FIND "${dir}" "${CMAKE_FILES_DIRECTORY}/" pos)
if(NOT pos LESS 0)
set(msg ", skipping non-system directory")
else()
set(msg "")
list(APPEND implicit_${t} "${dir}")
endif()
set(log "${log} collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n")
endforeach()
list(REMOVE_DUPLICATES implicit_${t})
endforeach() endforeach()
list(REMOVE_DUPLICATES implicit_dirs)
# Log results. # Log results.
set(log "${log} implicit libs: [${implicit_libs}]\n") set(log "${log} implicit libs: [${implicit_libs}]\n")
set(log "${log} implicit dirs: [${implicit_dirs}]\n") set(log "${log} implicit dirs: [${implicit_dirs}]\n")
set(log "${log} implicit fwks: [${implicit_fwks}]\n")
# Return results. # Return results.
set(${lib_var} "${implicit_libs}" PARENT_SCOPE) set(${lib_var} "${implicit_libs}" PARENT_SCOPE)
set(${dir_var} "${implicit_dirs}" PARENT_SCOPE) set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE)
set(${log_var} "${log}" PARENT_SCOPE) set(${log_var} "${log}" PARENT_SCOPE)
endfunction() endfunction()

View File

@ -35,11 +35,8 @@
#elif defined(__hpux) || defined(__hpux__) #elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX" # define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) #elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku" # define PLATFORM_ID "Haiku"
/* Haiku also defines __BEOS__ so we must
put it prior to the check for __BEOS__
*/
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS" # define PLATFORM_ID "BeOS"

View File

@ -438,6 +438,7 @@ if(NOT CPACK_GENERATOR)
endif() endif()
else() else()
option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF)
option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
endif() endif()
@ -453,6 +454,7 @@ if(NOT CPACK_GENERATOR)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
endif() endif()
@ -483,7 +485,7 @@ endif()
mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11 mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP) CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
@ -522,6 +524,9 @@ cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
# WiX specific variables
cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
if(DEFINED CPACK_COMPONENTS_ALL) if(DEFINED CPACK_COMPONENTS_ALL)
if(CPACK_MONOLITHIC_INSTALL) if(CPACK_MONOLITHIC_INSTALL)
message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")

109
Modules/CPackWIX.cmake Normal file
View File

@ -0,0 +1,109 @@
##section Variables specific to CPack WiX generator
##end
##module
# - CPack WiX generator specific options
#
# The following variables are specific to the installers built
# on Windows using WiX.
##end
##variable
# CPACK_WIX_UPGRADE_GUID - Upgrade GUID (Product/@UpgradeCode)
#
# Will be automatically generated unless explicitly provided.
#
# It should be explicitly set to a constant generated
# gloabally unique identifier (GUID) to allow your installers
# to replace existing installations that use the same GUID.
#
# You may for example explicitly set this variable in
# your CMakeLists.txt to the value that has been generated per default.
# You should not use GUIDs that you did not generate yourself or which may
# belong to other projects.
#
# A GUID shall have the following fixed length syntax:
# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
# (each X represents an uppercase hexadecimal digit)
##end
##variable
# CPACK_WIX_PRODUCT_GUID - Product GUID (Product/@Id)
#
# Will be automatically generated unless explicitly provided.
#
# If explicitly provided this will set the Product Id of your installer.
#
# The installer will abort if it detects a pre-existing installation that uses
# the same GUID.
#
# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
##end
##variable
# CPACK_WIX_LICENSE_RTF - RTF License File
#
# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension
# it is used as-is.
#
# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension
# it is implicitly converted to RTF by the WiX Generator.
#
# With CPACK_WIX_LICENSE_RTF you can override the license file used
# by the WiX Generator in case CPACK_RESOURCE_FILE_LICENSE
# is in an unsupported format or the .txt -> .rtf
# conversion does not work as expected.
#
##end
#
##variable
# CPACK_WIX_PRODUCT_ICON - The Icon shown next to the program name in Add/Remove programs.
#
# If set, this icon is used in place of the default icon.
#
##end
#
##variable
# CPACK_WIX_UI_BANNER - The bitmap will appear at the top of all installer pages other than the welcome and completion dialogs.
#
# If set, this image will replace the default banner image.
#
# This image must be 493 by 58 pixels.
#
##end
#
##variable
# CPACK_WIX_UI_DIALOG - Background bitmap used on the welcome and completion dialogs.
#
# If this variable is set, the installer will replace the default dialog image.
#
# This image must be 493 by 312 pixels.
#
##end
#=============================================================================
# Copyright 2012 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(NOT CPACK_WIX_ROOT)
file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
endif()
find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
PATHS "${CPACK_WIX_ROOT}/bin")
if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
message(FATAL_ERROR "Could not find the WiX candle executable.")
endif()
find_program(CPACK_WIX_LIGHT_EXECUTABLE light
PATHS "${CPACK_WIX_ROOT}/bin")
if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
message(FATAL_ERROR "Could not find the WiX light executable.")
endif()

View File

@ -35,7 +35,7 @@ if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
CACHE INTERNAL "CTEST_USE_LAUNCHERS initial value from ENV") CACHE INTERNAL "CTEST_USE_LAUNCHERS initial value from ENV")
endif() endif()
if(NOT "${CMAKE_GENERATOR}" MATCHES "Make") if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
set(CTEST_USE_LAUNCHERS 0) set(CTEST_USE_LAUNCHERS 0)
endif() endif()

View File

@ -16,7 +16,7 @@ int main(int ac, char*av[]){
pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[0], 0, runner, (void*)1);
pthread_create(&tid[1], 0, runner, (void*)2); pthread_create(&tid[1], 0, runner, (void*)2);
#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.) #if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.)
usleep(1); // for strange behavior on single-processor sun usleep(1); // for strange behavior on single-processor sun
#endif #endif

View File

@ -24,7 +24,6 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
PreprocessorDefinitions=""
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -35,9 +34,10 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
LinkIncremental="1" LinkIncremental="1"
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="false" GenerateDebugInformation="false"
SubSystem="1" SubSystem="@id_subsystem@"
TargetMachine="@id_machine_7@" EntryPointSymbol="@id_entrypoint@"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"

View File

@ -47,7 +47,7 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
find_program(BISON_EXECUTABLE bison DOC "path to the bison executable") find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
mark_as_advanced(BISON_EXECUTABLE) mark_as_advanced(BISON_EXECUTABLE)
if(BISON_EXECUTABLE) if(BISON_EXECUTABLE)

View File

@ -33,6 +33,8 @@ macro(_FIND_BULLET_LIBRARY _var)
${ARGN} ${ARGN}
HINTS HINTS
${BULLET_ROOT} ${BULLET_ROOT}
${BULLET_ROOT}/lib/Release
${BULLET_ROOT}/lib/Debug
${BULLET_ROOT}/out/release8/libs ${BULLET_ROOT}/out/release8/libs
${BULLET_ROOT}/out/debug8/libs ${BULLET_ROOT}/out/debug8/libs
PATH_SUFFIXES lib PATH_SUFFIXES lib

View File

@ -63,7 +63,7 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
find_program(FLEX_EXECUTABLE flex DOC "path to the flex executable") find_program(FLEX_EXECUTABLE NAMES flex win_flex DOC "path to the flex executable")
mark_as_advanced(FLEX_EXECUTABLE) mark_as_advanced(FLEX_EXECUTABLE)
find_library(FL_LIBRARY NAMES fl find_library(FL_LIBRARY NAMES fl
@ -93,10 +93,12 @@ if(FLEX_EXECUTABLE)
else() else()
# older versions of flex printed "/full/path/to/executable version X.Y" # older versions of flex printed "/full/path/to/executable version X.Y"
# newer versions use "basename(executable) X.Y" # newer versions use "basename(executable) X.Y"
get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME) get_filename_component(FLEX_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE)
string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\2" get_filename_component(FLEX_EXE_EXT "${FLEX_EXECUTABLE}" EXT)
string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\3"
FLEX_VERSION "${FLEX_version_output}") FLEX_VERSION "${FLEX_version_output}")
unset(FLEX_EXE_NAME) unset(FLEX_EXE_EXT)
unset(FLEX_EXE_NAME_WE)
endif() endif()
#============================================================ #============================================================

View File

@ -46,6 +46,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
HINTS HINTS
ENV FREETYPE_DIR ENV FREETYPE_DIR
PATHS PATHS
/usr/X11R6
/usr/local/X11R6 /usr/local/X11R6
/usr/local/X11 /usr/local/X11
/usr/freeware /usr/freeware
@ -56,6 +57,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
HINTS HINTS
ENV FREETYPE_DIR ENV FREETYPE_DIR
PATHS PATHS
/usr/X11R6
/usr/local/X11R6 /usr/local/X11R6
/usr/local/X11 /usr/local/X11
/usr/freeware /usr/freeware
@ -68,6 +70,7 @@ find_library(FREETYPE_LIBRARY
ENV FREETYPE_DIR ENV FREETYPE_DIR
PATH_SUFFIXES lib PATH_SUFFIXES lib
PATHS PATHS
/usr/X11R6
/usr/local/X11R6 /usr/local/X11R6
/usr/local/X11 /usr/local/X11
/usr/freeware /usr/freeware

View File

@ -40,25 +40,39 @@ else ()
set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
else () else ()
if (BEOS)
set(_GLUT_INC_DIR /boot/develop/headers/os/opengl)
set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86)
else()
find_library( GLUT_Xi_LIBRARY Xi
/usr/openwin/lib
)
find_library( GLUT_Xmu_LIBRARY Xmu
/usr/openwin/lib
)
endif ()
find_path( GLUT_INCLUDE_DIR GL/glut.h find_path( GLUT_INCLUDE_DIR GL/glut.h
/usr/include/GL /usr/include/GL
/usr/openwin/share/include /usr/openwin/share/include
/usr/openwin/include /usr/openwin/include
/opt/graphics/OpenGL/include /opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglut /opt/graphics/OpenGL/contrib/libglut
${_GLUT_INC_DIR}
) )
find_library( GLUT_glut_LIBRARY glut find_library( GLUT_glut_LIBRARY glut
/usr/openwin/lib /usr/openwin/lib
${_GLUT_glut_LIB_DIR}
) )
find_library( GLUT_Xi_LIBRARY Xi unset(_GLUT_INC_DIR)
/usr/openwin/lib unset(_GLUT_glut_LIB_DIR)
)
find_library( GLUT_Xmu_LIBRARY Xmu
/usr/openwin/lib
)
endif () endif ()

View File

@ -209,5 +209,3 @@ function(GETTEXT_PROCESS_PO_FILES _lang)
add_dependencies(pofiles ${uniqueTargetName}) add_dependencies(pofiles ${uniqueTargetName})
endfunction() endfunction()
set(GETTEXT_FOUND ${Gettext_FOUND})

View File

@ -120,6 +120,11 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
/usr/lib/jvm/default-java/jre/lib/{libarch} /usr/lib/jvm/default-java/jre/lib/{libarch}
/usr/lib/jvm/default-java/jre/lib /usr/lib/jvm/default-java/jre/lib
/usr/lib/jvm/default-java/lib /usr/lib/jvm/default-java/lib
# OpenBSD specific paths for default JVM
/usr/local/jdk-1.7.0/jre/lib/{libarch}
/usr/local/jre-1.7.0/lib/{libarch}
/usr/local/jdk-1.6.0/jre/lib/{libarch}
/usr/local/jre-1.6.0/lib/{libarch}
) )
set(JAVA_JVM_LIBRARY_DIRECTORIES) set(JAVA_JVM_LIBRARY_DIRECTORIES)
@ -153,6 +158,9 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES
/opt/sun-jdk-1.5.0.04/include /opt/sun-jdk-1.5.0.04/include
# Debian specific path for default JVM # Debian specific path for default JVM
/usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include
# OpenBSD specific path for default JVM
/usr/local/jdk-1.7.0/include
/usr/local/jdk-1.6.0/include
) )
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
@ -227,6 +235,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h
${JAVA_INCLUDE_PATH}/win32 ${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux ${JAVA_INCLUDE_PATH}/linux
${JAVA_INCLUDE_PATH}/freebsd ${JAVA_INCLUDE_PATH}/freebsd
${JAVA_INCLUDE_PATH}/openbsd
${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/solaris
${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/hp-ux
${JAVA_INCLUDE_PATH}/alpha ${JAVA_INCLUDE_PATH}/alpha

View File

@ -80,6 +80,8 @@ set(_JAVA_PATHS
/usr/java/j2sdk1.4.2_09/bin /usr/java/j2sdk1.4.2_09/bin
/usr/lib/j2sdk1.5-sun/bin /usr/lib/j2sdk1.5-sun/bin
/opt/sun-jdk-1.5.0.04/bin /opt/sun-jdk-1.5.0.04/bin
/usr/local/jdk-1.7.0/bin
/usr/local/jdk-1.6.0/bin
) )
find_program(Java_JAVA_EXECUTABLE find_program(Java_JAVA_EXECUTABLE
NAMES java NAMES java
@ -107,6 +109,7 @@ if(Java_JAVA_EXECUTABLE)
# 2. OpenJDK 1.6 # 2. OpenJDK 1.6
# 3. GCJ 1.5 # 3. GCJ 1.5
# 4. Kaffe 1.4.2 # 4. Kaffe 1.4.2
# 5. OpenJDK 1.7.x on OpenBSD
if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
@ -115,6 +118,10 @@ if(Java_JAVA_EXECUTABLE)
# Kaffe style # Kaffe style
string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
"\\1" Java_VERSION_STRING "${var}" ) "\\1" Java_VERSION_STRING "${var}" )
elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
# OpenJDK ver 1.7.x on OpenBSD
string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
"\\1" Java_VERSION_STRING "${var}" )
else() else()
if(NOT Java_FIND_QUIETLY) if(NOT Java_FIND_QUIETLY)
message(WARNING "regex not supported: ${var}. Please report") message(WARNING "regex not supported: ${var}. Please report")

View File

@ -28,7 +28,7 @@
find_path(LUA_INCLUDE_DIR lua.h find_path(LUA_INCLUDE_DIR lua.h
HINTS HINTS
ENV LUA_DIR ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
PATHS PATHS
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
@ -54,7 +54,7 @@ find_library(LUA_LIBRARY
if(LUA_LIBRARY) if(LUA_LIBRARY)
# include the math library for Unix # include the math library for Unix
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m) find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library # For Windows and Mac, don't need to explicitly include the math library

View File

@ -58,14 +58,22 @@ else ()
find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
else() else()
# Handle HP-UX cases where we only want to find OpenGL in either hpux64 if (CMAKE_SYSTEM_NAME MATCHES "HP-UX")
# or hpux32 depending on if we're doing a 64 bit build. # Handle HP-UX cases where we only want to find OpenGL in either hpux64
if(CMAKE_SIZEOF_VOID_P EQUAL 4) # or hpux32 depending on if we're doing a 64 bit build.
set(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
else() set(_OPENGL_LIB_PATH
set(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
/opt/graphics/OpenGL/lib/hpux64/ else()
/opt/graphics/OpenGL/lib/pa20_64) set(_OPENGL_LIB_PATH
/opt/graphics/OpenGL/lib/hpux64/
/opt/graphics/OpenGL/lib/pa20_64)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku)
set(_OPENGL_LIB_PATH
/boot/develop/lib/x86)
set(_OPENGL_INCLUDE_PATH
/boot/develop/headers/os/opengl)
endif() endif()
# The first line below is to make sure that the proper headers # The first line below is to make sure that the proper headers
@ -80,6 +88,7 @@ else ()
/usr/share/doc/NVIDIA_GLX-1.0/include /usr/share/doc/NVIDIA_GLX-1.0/include
/usr/openwin/share/include /usr/openwin/share/include
/opt/graphics/OpenGL/include /usr/X11R6/include /opt/graphics/OpenGL/include /usr/X11R6/include
${_OPENGL_INCLUDE_PATH}
) )
find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
@ -93,9 +102,12 @@ else ()
PATHS /opt/graphics/OpenGL/lib PATHS /opt/graphics/OpenGL/lib
/usr/openwin/lib /usr/openwin/lib
/usr/shlib /usr/X11R6/lib /usr/shlib /usr/X11R6/lib
${HPUX_IA_OPENGL_LIB_PATH} ${_OPENGL_LIB_PATH}
) )
unset(_OPENGL_INCLUDE_PATH)
unset(_OPENGL_LIB_PATH)
# On Unix OpenGL most certainly always requires X11. # On Unix OpenGL most certainly always requires X11.
# Feel free to tighten up these conditions if you don't # Feel free to tighten up these conditions if you don't
# think this is always true. # think this is always true.

View File

@ -187,8 +187,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# user knows better what went wrong (#6375) # user knows better what went wrong (#6375)
set(MISSING_VARS "") set(MISSING_VARS "")
set(DETAILS "") set(DETAILS "")
set(${_NAME_UPPER}_FOUND TRUE)
# check if all passed variables are valid # check if all passed variables are valid
unset(${_NAME_UPPER}_FOUND)
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR}) if(NOT ${_CURRENT_VAR})
set(${_NAME_UPPER}_FOUND FALSE) set(${_NAME_UPPER}_FOUND FALSE)
@ -197,6 +197,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
endif() endif()
endforeach() endforeach()
if(NOT "${${_NAME_UPPER}_FOUND}" STREQUAL "FALSE")
set(${_NAME_UPPER}_FOUND TRUE)
endif()
# component handling # component handling
unset(FOUND_COMPONENTS_MSG) unset(FOUND_COMPONENTS_MSG)

View File

@ -43,6 +43,12 @@ if(GLOB_TEMP_VAR)
endif() endif()
set(GLOB_TEMP_VAR) set(GLOB_TEMP_VAR)
file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt3/bin/qmake)
if(GLOB_TEMP_VAR)
set(QT3_INSTALLED TRUE)
endif()
set(GLOB_TEMP_VAR)
# look for qt4 installations # look for qt4 installations
file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake) file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake)
if(GLOB_TEMP_VAR) if(GLOB_TEMP_VAR)
@ -56,6 +62,12 @@ if(GLOB_TEMP_VAR)
endif() endif()
set(GLOB_TEMP_VAR) set(GLOB_TEMP_VAR)
file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt4/bin/qmake)
if(GLOB_TEMP_VAR)
set(QT4_INSTALLED TRUE)
endif()
set(GLOB_TEMP_VAR)
if (Qt_FIND_VERSION) if (Qt_FIND_VERSION)
set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}") set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}")
endif () endif ()
@ -91,6 +103,7 @@ find_file( QT4_QGLOBAL_H_FILE qglobal.h
/usr/lib/qt/include/Qt /usr/lib/qt/include/Qt
/usr/include/Qt /usr/include/Qt
/usr/share/qt4/include/Qt /usr/share/qt4/include/Qt
/usr/local/include/X11/qt4/Qt
C:/Progra~1/qt/include/Qt ) C:/Progra~1/qt/include/Qt )
if(QT4_QGLOBAL_H_FILE) if(QT4_QGLOBAL_H_FILE)
@ -110,6 +123,7 @@ find_file( QT3_QGLOBAL_H_FILE qglobal.h
/usr/lib/qt/include /usr/lib/qt/include
/usr/include /usr/include
/usr/share/qt3/include /usr/share/qt3/include
/usr/local/include/X11/qt3
C:/Progra~1/qt/include C:/Progra~1/qt/include
/usr/include/qt3 ) /usr/include/qt3 )

View File

@ -64,6 +64,7 @@ find_path(QT_INCLUDE_DIR qt.h
/usr/share/qt3/include /usr/share/qt3/include
C:/Progra~1/qt/include C:/Progra~1/qt/include
/usr/include/qt3 /usr/include/qt3
/usr/local/include/X11/qt3
) )
# if qglobal.h is not in the qt_include_dir then set # if qglobal.h is not in the qt_include_dir then set
@ -146,7 +147,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY
# Qt 3 should prefer QTDIR over the PATH # Qt 3 should prefer QTDIR over the PATH
find_program(QT_MOC_EXECUTABLE find_program(QT_MOC_EXECUTABLE
NAMES moc-qt3 moc NAMES moc-qt3 moc moc3 moc3-mt
HINTS HINTS
ENV QTDIR ENV QTDIR
PATHS PATHS
@ -154,6 +155,7 @@ find_program(QT_MOC_EXECUTABLE
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
${GLOB_PATHS_BIN} ${GLOB_PATHS_BIN}
/usr/local/lib/qt3
/usr/local/qt /usr/local/qt
/usr/lib/qt /usr/lib/qt
/usr/lib/qt3 /usr/lib/qt3
@ -170,7 +172,7 @@ endif()
# Qt 3 should prefer QTDIR over the PATH # Qt 3 should prefer QTDIR over the PATH
find_program(QT_UIC_EXECUTABLE find_program(QT_UIC_EXECUTABLE
NAMES uic-qt3 uic NAMES uic-qt3 uic uic3 uic3-mt
HINTS HINTS
ENV QTDIR ENV QTDIR
PATHS PATHS

View File

@ -65,6 +65,10 @@
# is much more flexible, but requires that FindQt4.cmake is executed before # is much more flexible, but requires that FindQt4.cmake is executed before
# such an exported dependency file is processed. # such an exported dependency file is processed.
# #
# QT_INCLUDE_DIRS_NO_SYSTEM
# If this variable is set to TRUE, the Qt include directories
# in the QT_USE_FILE will NOT have the SYSTEM keyword set.
#
# There are also some files that need processing by some Qt tools such as moc # There are also some files that need processing by some Qt tools such as moc
# and uic. Listed below are macros that may be used to process those files. # and uic. Listed below are macros that may be used to process those files.
# #
@ -414,6 +418,15 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
endif() endif()
endif () endif ()
set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
"${QT_${basename}_INCLUDE_DIR}"
)
string(REGEX REPLACE "^QT" "" _stemname ${basename})
set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY
INTERFACE_COMPILE_DEFINITIONS
"QT_${_stemname}_LIB"
)
endif() endif()
# If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
@ -534,6 +547,11 @@ endif ()
if (QT_QMAKE_EXECUTABLE AND QTVERSION) if (QT_QMAKE_EXECUTABLE AND QTVERSION)
# set version variables
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
# ask qmake for the mkspecs directory # ask qmake for the mkspecs directory
# we do this first because QT_LIBINFIX might be set # we do this first because QT_LIBINFIX might be set
if (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) if (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED)
@ -938,12 +956,49 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
############################################ ############################################
macro(_qt4_add_target_depends_internal _QT_MODULE _PROPERTY)
if (TARGET Qt4::${_QT_MODULE})
foreach(_DEPEND ${ARGN})
if (NOT TARGET Qt4::Qt${_DEPEND})
message(FATAL_ERROR "_qt4_add_target_depends invoked with invalid arguments")
endif()
set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
${_PROPERTY}
"Qt4::Qt${_DEPEND}"
)
set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
"$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_INCLUDE_DIRECTORIES>"
)
set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS
"$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_COMPILE_DEFINITIONS>"
)
endforeach()
endif()
endmacro()
macro(_qt4_add_target_depends _QT_MODULE)
_qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES ${ARGN})
endmacro()
macro(_qt4_add_target_private_depends _QT_MODULE)
_qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES ${ARGN})
endmacro()
# Set QT_xyz_LIBRARY variable and add # Set QT_xyz_LIBRARY variable and add
# library include path to QT_INCLUDES # library include path to QT_INCLUDES
_QT4_ADJUST_LIB_VARS(QtCore) _QT4_ADJUST_LIB_VARS(QtCore)
set_property(TARGET Qt4::QtCore APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
"${QT_MKSPECS_DIR}/default"
${QT_INCLUDE_DIR}
)
foreach(QT_MODULE ${QT_MODULES}) foreach(QT_MODULE ${QT_MODULES})
_QT4_ADJUST_LIB_VARS(${QT_MODULE}) _QT4_ADJUST_LIB_VARS(${QT_MODULE})
_qt4_add_target_depends(${QT_MODULE} Core)
endforeach() endforeach()
_QT4_ADJUST_LIB_VARS(QtAssistant) _QT4_ADJUST_LIB_VARS(QtAssistant)
@ -958,6 +1013,41 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
_QT4_ADJUST_LIB_VARS(QAxContainer) _QT4_ADJUST_LIB_VARS(QAxContainer)
endif() endif()
# Only public dependencies are listed here.
# Eg, QtDBus links to QtXml, but users of QtDBus do not need to
# link to QtXml because QtDBus only uses it internally, not in public
# headers.
# Everything depends on QtCore, but that is covered above already
_qt4_add_target_depends(Qt3Support Sql Gui Network)
if (TARGET Qt4::Qt3Support)
# An additional define is required for QT3_SUPPORT
set_property(TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT)
endif()
_qt4_add_target_depends(QtDeclarative Script Gui)
_qt4_add_target_depends(QtDesigner Gui)
_qt4_add_target_depends(QtHelp Gui)
_qt4_add_target_depends(QtMultimedia Gui)
_qt4_add_target_depends(QtOpenGL Gui)
_qt4_add_target_depends(QtSvg Gui)
_qt4_add_target_depends(QtWebKit Gui Network)
_qt4_add_target_private_depends(Qt3Support Xml)
_qt4_add_target_private_depends(QtSvg Xml)
_qt4_add_target_private_depends(QtDBus Xml)
_qt4_add_target_private_depends(QtUiTools Xml Gui)
_qt4_add_target_private_depends(QtHelp Sql Xml Network)
_qt4_add_target_private_depends(QtXmlPatterns Network)
_qt4_add_target_private_depends(QtScriptTools Gui)
_qt4_add_target_private_depends(QtWebKit XmlPatterns)
_qt4_add_target_private_depends(QtDeclarative XmlPatterns Svg Sql Gui)
_qt4_add_target_private_depends(QtMultimedia Gui)
_qt4_add_target_private_depends(QtOpenGL Gui)
_qt4_add_target_private_depends(QAxServer Gui)
_qt4_add_target_private_depends(QAxContainer Gui)
_qt4_add_target_private_depends(phonon Gui)
if(QT_QTDBUS_FOUND)
_qt4_add_target_private_depends(phonon DBus)
endif()
####################################### #######################################
# #
@ -982,13 +1072,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endif() endif()
find_program(QT_MOC_EXECUTABLE find_program(QT_MOC_EXECUTABLE
NAMES moc-qt4 moc NAMES moc-qt4 moc moc4
PATHS ${QT_BINARY_DIR} PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
find_program(QT_UIC_EXECUTABLE find_program(QT_UIC_EXECUTABLE
NAMES uic-qt4 uic NAMES uic-qt4 uic uic4
PATHS ${QT_BINARY_DIR} PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
@ -1018,13 +1108,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
) )
find_program(QT_LUPDATE_EXECUTABLE find_program(QT_LUPDATE_EXECUTABLE
NAMES lupdate-qt4 lupdate NAMES lupdate-qt4 lupdate lupdate4
PATHS ${QT_BINARY_DIR} PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
find_program(QT_LRELEASE_EXECUTABLE find_program(QT_LRELEASE_EXECUTABLE
NAMES lrelease-qt4 lrelease NAMES lrelease-qt4 lrelease lrelease4
PATHS ${QT_BINARY_DIR} PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
@ -1036,13 +1126,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
) )
find_program(QT_DESIGNER_EXECUTABLE find_program(QT_DESIGNER_EXECUTABLE
NAMES designer-qt4 designer NAMES designer-qt4 designer designer4
PATHS ${QT_BINARY_DIR} PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
find_program(QT_LINGUIST_EXECUTABLE find_program(QT_LINGUIST_EXECUTABLE
NAMES linguist-qt4 linguist NAMES linguist-qt4 linguist linguist4
PATHS ${QT_BINARY_DIR} PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
@ -1170,11 +1260,6 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
include("${_qt4_current_dir}/Qt4Macros.cmake") include("${_qt4_current_dir}/Qt4Macros.cmake")
# set version variables
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
endif() endif()
#support old QT_MIN_VERSION if set, but not if version is supplied by find_package() #support old QT_MIN_VERSION if set, but not if version is supplied by find_package()

View File

@ -122,7 +122,7 @@ if(SDL_LIBRARY_TEMP)
if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY) if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY)
list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX) list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX)
if(_SDL_MAIN_INDEX EQUAL -1) if(_SDL_MAIN_INDEX EQUAL -1)
list(APPEND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}") set(SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL_LIBRARY_TEMP})
endif() endif()
unset(_SDL_MAIN_INDEX) unset(_SDL_MAIN_INDEX)
endif() endif()

View File

@ -40,7 +40,7 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
HINTS HINTS
ENV SDLIMAGEDIR ENV SDLIMAGEDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11 PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
) )
if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY) if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
@ -52,6 +52,7 @@ find_library(SDL_IMAGE_LIBRARY
HINTS HINTS
ENV SDLIMAGEDIR ENV SDLIMAGEDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES lib
) )
if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h") if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")

View File

@ -40,7 +40,7 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS HINTS
ENV SDLMIXERDIR ENV SDLMIXERDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11 PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
) )
if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY) if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
@ -52,6 +52,7 @@ find_library(SDL_MIXER_LIBRARY
HINTS HINTS
ENV SDLMIXERDIR ENV SDLMIXERDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES lib
) )
if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h") if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")

View File

@ -40,7 +40,7 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
HINTS HINTS
ENV SDLNETDIR ENV SDLNETDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11 PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
) )
if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY) if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
@ -52,6 +52,7 @@ find_library(SDL_NET_LIBRARY
HINTS HINTS
ENV SDLNETDIR ENV SDLNETDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES lib
) )
if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h") if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")

View File

@ -77,7 +77,7 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS HINTS
ENV SDLSOUNDDIR ENV SDLSOUNDDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11 PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
) )
find_library(SDL_SOUND_LIBRARY find_library(SDL_SOUND_LIBRARY
@ -85,6 +85,7 @@ find_library(SDL_SOUND_LIBRARY
HINTS HINTS
ENV SDLSOUNDDIR ENV SDLSOUNDDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES lib
) )
if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)

View File

@ -40,7 +40,7 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
HINTS HINTS
ENV SDLTTFDIR ENV SDLTTFDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11 PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
) )
if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY) if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
@ -52,6 +52,7 @@ find_library(SDL_TTF_LIBRARY
HINTS HINTS
ENV SDLTTFDIR ENV SDLTTFDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES lib
) )
if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h") if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")

View File

@ -82,6 +82,10 @@ set(TCLTK_POSSIBLE_LIB_PATHS
"${TK_LIBRARY_PATH}" "${TK_LIBRARY_PATH}"
"${TCL_TCLSH_PATH_PARENT}/lib" "${TCL_TCLSH_PATH_PARENT}/lib"
"${TK_WISH_PATH_PARENT}/lib" "${TK_WISH_PATH_PARENT}/lib"
/usr/local/lib/tcl/tcl8.5
/usr/local/lib/tcl/tk8.5
/usr/local/lib/tcl/tcl8.4
/usr/local/lib/tcl/tk8.4
) )
if(WIN32) if(WIN32)
@ -168,6 +172,10 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS
/usr/include/tcl8.3 /usr/include/tcl8.3
/usr/include/tcl8.2 /usr/include/tcl8.2
/usr/include/tcl8.0 /usr/include/tcl8.0
/usr/local/include/tcl8.5
/usr/local/include/tk8.5
/usr/local/include/tcl8.4
/usr/local/include/tk8.4
) )
if(WIN32) if(WIN32)

View File

@ -37,6 +37,9 @@
;Set compression ;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@ SetCompressor @CPACK_NSIS_COMPRESSOR@
;Require administrator access
RequestExecutionLevel admin
@CPACK_NSIS_DEFINES@ @CPACK_NSIS_DEFINES@
!include Sections.nsh !include Sections.nsh
@ -119,7 +122,7 @@ Var AR_RegFlags
"exit_${SecName}:" "exit_${SecName}:"
!macroend !macroend
!macro RemoveSection SecName !macro RemoveSection_CPack SecName
; This macro is used to call section's Remove_... macro ; This macro is used to call section's Remove_... macro
;from the uninstaller. ;from the uninstaller.
;Input: section index constant name specified in Section command. ;Input: section index constant name specified in Section command.
@ -841,7 +844,7 @@ Section "Uninstall"
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
; Removes all optional components ; Removes all optional components
!insertmacro SectionList "RemoveSection" !insertmacro SectionList "RemoveSection_CPack"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

View File

@ -19,6 +19,7 @@ endif()
set(__DARWIN_COMPILER_CLANG 1) set(__DARWIN_COMPILER_CLANG 1)
macro(__darwin_compiler_clang lang) macro(__darwin_compiler_clang lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")

View File

@ -19,6 +19,7 @@ endif()
set(__DARWIN_COMPILER_GNU 1) set(__DARWIN_COMPILER_GNU 1)
macro(__darwin_compiler_gnu lang) macro(__darwin_compiler_gnu lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
# GNU does not have -shared on OS X # GNU does not have -shared on OS X
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")

View File

@ -256,6 +256,24 @@ set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK
if(NOT DEFINED CMAKE_FIND_FRAMEWORK) if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
set(CMAKE_FIND_FRAMEWORK FIRST) set(CMAKE_FIND_FRAMEWORK FIRST)
endif() endif()
# Older OS X linkers do not report their framework search path
# with -v but "man ld" documents the following locations.
set(CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks
${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks
)
if(_CMAKE_OSX_SYSROOT_PATH)
# Treat some paths as implicit so we do not override the SDK versions.
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
/System/Library/Frameworks)
endif()
if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5")
# Older OS X tools had more implicit paths.
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks)
endif()
# set up the default search directories for frameworks # set up the default search directories for frameworks
set(CMAKE_SYSTEM_FRAMEWORK_PATH set(CMAKE_SYSTEM_FRAMEWORK_PATH
~/Library/Frameworks ~/Library/Frameworks

View File

@ -16,3 +16,7 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
endif() endif()
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
# OpenBSD policy requires that shared libraries be installed without
# executable permission.
set(CMAKE_INSTALL_SO_NO_EXE 1)

View File

@ -50,7 +50,7 @@ elseif(MSVC_CXX_ARCHITECTURE_ID)
elseif(MSVC_Fortran_ARCHITECTURE_ID) elseif(MSVC_Fortran_ARCHITECTURE_ID)
set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
endif() endif()
set (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}")
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")

View File

@ -165,7 +165,7 @@ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags # executable linker flags
set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
# set the stack size and the machine type # set the machine type
set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
if(NOT _MACHINE_ARCH_FLAG) if(NOT _MACHINE_ARCH_FLAG)
set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
@ -178,7 +178,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
endif() endif()
endif() endif()
set (CMAKE_EXE_LINKER_FLAGS_INIT set (CMAKE_EXE_LINKER_FLAGS_INIT
"${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}")
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
# on versions that support it # on versions that support it

View File

@ -25,7 +25,11 @@ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
endif() endif()
include_directories(${QT_INCLUDE_DIR}) if(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(${QT_INCLUDE_DIR})
else(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(SYSTEM ${QT_INCLUDE_DIR})
endif(QT_INCLUDE_DIRS_NO_SYSTEM)
set(QT_LIBRARIES "") set(QT_LIBRARIES "")
set(QT_LIBRARIES_PLUGINS "") set(QT_LIBRARIES_PLUGINS "")
@ -89,7 +93,11 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
if(QT_USE_${module}) if(QT_USE_${module})
string(REPLACE "QT" "" qt_module_def "${module}") string(REPLACE "QT" "" qt_module_def "${module}")
add_definitions(-DQT_${qt_module_def}_LIB) add_definitions(-DQT_${qt_module_def}_LIB)
include_directories(${QT_${module}_INCLUDE_DIR}) if(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(${QT_${module}_INCLUDE_DIR})
else(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR})
endif(QT_INCLUDE_DIRS_NO_SYSTEM)
endif() endif()
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS}) set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})

44
Modules/WIX.template.in Normal file
View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<?include "cpack_variables.wxi"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
RequiredVersion="3.6.3303.0">
<Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
Name="$(var.CPACK_PACKAGE_NAME)"
Language="1033"
Version="$(var.CPACK_PACKAGE_VERSION)"
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
<Package InstallerVersion="301" Compressed="yes"/>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
<MajorUpgrade
Schedule="afterInstallInitialize"
AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
<?ifdef CPACK_WIX_PRODUCT_ICON?>
<Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
<Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_BANNER?>
<WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_DIALOG?>
<WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
<?endif?>
<FeatureRef Id="ProductFeature"/>
<UIRef Id="WixUI_InstallDir" />
</Product>
</Wix>

View File

@ -355,6 +355,8 @@ if (WIN32)
cmLocalVisualStudio7Generator.h cmLocalVisualStudio7Generator.h
cmLocalVisualStudioGenerator.cxx cmLocalVisualStudioGenerator.cxx
cmLocalVisualStudioGenerator.h cmLocalVisualStudioGenerator.h
cmVisualStudioWCEPlatformParser.h
cmVisualStudioWCEPlatformParser.cxx
cmWin32ProcessExecution.cxx cmWin32ProcessExecution.cxx
cmWin32ProcessExecution.h cmWin32ProcessExecution.h
) )
@ -499,6 +501,14 @@ if(UNIX)
) )
endif() endif()
if(WIN32)
set(CPACK_SRCS ${CPACK_SRCS}
CPack/WiX/cmCPackWIXGenerator.cxx
CPack/WiX/cmWIXSourceWriter.cxx
CPack/WiX/cmWIXRichTextFormatWriter.cxx
)
endif()
if(APPLE) if(APPLE)
set(CPACK_SRCS ${CPACK_SRCS} set(CPACK_SRCS ${CPACK_SRCS}
CPack/cmCPackBundleGenerator.cxx CPack/cmCPackBundleGenerator.cxx

View File

@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8) set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 10) set(CMake_VERSION_PATCH 10)
set(CMake_VERSION_TWEAK 20121124) set(CMake_VERSION_TWEAK 20130110)
#set(CMake_VERSION_RC 1) #set(CMake_VERSION_RC 1)

View File

@ -0,0 +1,571 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmCPackWIXGenerator.h"
#include <cmSystemTools.h>
#include <cmGeneratedFileStream.h>
#include <CPack/cmCPackLog.h>
#include <CPack/cmCPackComponentGroup.h>
#include "cmWIXSourceWriter.h"
#include "cmWIXRichTextFormatWriter.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <rpc.h> // for GUID generation
int cmCPackWIXGenerator::InitializeInternal()
{
componentPackageMethod = ONE_PACKAGE;
return this->Superclass::InitializeInternal();
}
bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command)
{
std::string cpackTopLevel;
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{
return false;
}
std::string logFileName = cpackTopLevel + "/wix.log";
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Running WiX command: " << command << std::endl);
std::string output;
int returnValue = 0;
bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output,
&returnValue, 0, cmSystemTools::OUTPUT_NONE);
std::ofstream logFile(logFileName.c_str(), std::ios::app);
logFile << command << std::endl;
logFile << output;
logFile.close();
if(!status || returnValue)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem running WiX candle. "
"Please check '" << logFileName << "' for errors." << std::endl);
return false;
}
return true;
}
bool cmCPackWIXGenerator::RunCandleCommand(
const std::string& sourceFile, const std::string& objectFile)
{
std::string executable;
if(!RequireOption("CPACK_WIX_CANDLE_EXECUTABLE", executable))
{
return false;
}
std::stringstream command;
command << QuotePath(executable);
command << " -nologo";
command << " -arch " << GetArchitecture();
command << " -out " << QuotePath(objectFile);
command << " " << QuotePath(sourceFile);
return RunWiXCommand(command.str());
}
bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles)
{
std::string executable;
if(!RequireOption("CPACK_WIX_LIGHT_EXECUTABLE", executable))
{
return false;
}
std::stringstream command;
command << QuotePath(executable);
command << " -nologo";
command << " -out " << QuotePath(packageFileNames.at(0));
command << " -ext WixUIExtension";
command << " " << objectFiles;
return RunWiXCommand(command.str());
}
int cmCPackWIXGenerator::PackageFiles()
{
if(!PackageFilesImpl() || cmSystemTools::GetErrorOccuredFlag())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Fatal WiX Generator Error" << std::endl);
return false;
}
return true;
}
bool cmCPackWIXGenerator::InitializeWiXConfiguration()
{
if(!ReadListFile("CPackWIX.cmake"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while executing CPackWIX.cmake" << std::endl);
return false;
}
if(GetOption("CPACK_WIX_PRODUCT_GUID") == 0)
{
std::string guid = GenerateGUID();
SetOption("CPACK_WIX_PRODUCT_GUID", guid.c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"CPACK_WIX_PRODUCT_GUID implicitly set to " << guid << " . "
<< std::endl);
}
if(GetOption("CPACK_WIX_UPGRADE_GUID") == 0)
{
std::string guid = GenerateGUID();
SetOption("CPACK_WIX_UPGRADE_GUID", guid.c_str());
cmCPackLogger(cmCPackLog::LOG_WARNING,
"CPACK_WIX_UPGRADE_GUID implicitly set to " << guid << " . "
"Please refer to the documentation on how and why "
"you might want to set this explicitly." << std::endl);
}
std::string cpackTopLevel;
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{
return false;
}
if(GetOption("CPACK_WIX_LICENSE_RTF") == 0)
{
std::string licenseFilename = cpackTopLevel + "/License.rtf";
SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str());
if(!CreateLicenseFile())
{
return false;
}
}
return true;
}
bool cmCPackWIXGenerator::PackageFilesImpl()
{
if(!InitializeWiXConfiguration())
{
return false;
}
if(!CreateWiXVariablesIncludeFile())
{
return false;
}
if(!CreateWiXSourceFiles())
{
return false;
}
std::stringstream objectFiles;
for(size_t i = 0; i < wixSources.size(); ++i)
{
const std::string& sourceFilename = wixSources[i];
std::string objectFilename =
cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj";
if(!RunCandleCommand(sourceFilename, objectFilename))
{
return false;
}
objectFiles << " " << QuotePath(objectFilename);
}
return RunLightCommand(objectFiles.str());
}
bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
{
std::string cpackTopLevel;
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{
return false;
}
std::string includeFilename =
cpackTopLevel + "/cpack_variables.wxi";
cmWIXSourceWriter includeFile(Logger, includeFilename, true);
CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID");
CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID");
CopyDefinition(includeFile, "CPACK_PACKAGE_VENDOR");
CopyDefinition(includeFile, "CPACK_PACKAGE_NAME");
CopyDefinition(includeFile, "CPACK_PACKAGE_VERSION");
CopyDefinition(includeFile, "CPACK_WIX_LICENSE_RTF");
CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_ICON");
CopyDefinition(includeFile, "CPACK_WIX_UI_BANNER");
CopyDefinition(includeFile, "CPACK_WIX_UI_DIALOG");
return true;
}
void cmCPackWIXGenerator::CopyDefinition(
cmWIXSourceWriter &source, const std::string &name)
{
const char* value = GetOption(name.c_str());
if(value)
{
AddDefinition(source, name, value);
}
}
void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
const std::string& name, const std::string& value)
{
std::stringstream tmp;
tmp << name << "=\"" << value << '"';
source.AddProcessingInstruction("define",
cmWIXSourceWriter::WindowsCodepageToUtf8(tmp.str()));
}
bool cmCPackWIXGenerator::CreateWiXSourceFiles()
{
std::string cpackTopLevel;
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{
return false;
}
std::string directoryDefinitionsFilename =
cpackTopLevel + "/directories.wxs";
wixSources.push_back(directoryDefinitionsFilename);
cmWIXSourceWriter directoryDefinitions(Logger, directoryDefinitionsFilename);
directoryDefinitions.BeginElement("Fragment");
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", "TARGETDIR");
directoryDefinitions.AddAttribute("Name", "SourceDir");
directoryDefinitions.BeginElement("Directory");
if(GetArchitecture() == "x86")
{
directoryDefinitions.AddAttribute("Id", "ProgramFilesFolder");
}
else
{
directoryDefinitions.AddAttribute("Id", "ProgramFiles64Folder");
}
std::vector<std::string> install_root;
std::string tmp;
if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", tmp))
{
return false;
}
cmSystemTools::SplitPath(tmp.c_str(), install_root);
if(!install_root.empty() && install_root.back().empty())
{
install_root.pop_back();
}
for(size_t i = 1; i < install_root.size(); ++i)
{
directoryDefinitions.BeginElement("Directory");
if(i == install_root.size() - 1)
{
directoryDefinitions.AddAttribute("Id", "INSTALL_ROOT");
}
else
{
std::stringstream ss;
ss << "INSTALL_PREFIX_" << i;
directoryDefinitions.AddAttribute("Id", ss.str());
}
directoryDefinitions.AddAttribute("Name", install_root[i]);
}
size_t directoryCounter = 0;
size_t fileCounter = 0;
std::string fileDefinitionsFilename =
cpackTopLevel + "/files.wxs";
wixSources.push_back(fileDefinitionsFilename);
cmWIXSourceWriter fileDefinitions(Logger, fileDefinitionsFilename);
fileDefinitions.BeginElement("Fragment");
std::string featureDefinitionsFilename =
cpackTopLevel +"/features.wxs";
wixSources.push_back(featureDefinitionsFilename);
cmWIXSourceWriter featureDefinitions(Logger, featureDefinitionsFilename);
featureDefinitions.BeginElement("Fragment");
featureDefinitions.BeginElement("Feature");
featureDefinitions.AddAttribute("Id", "ProductFeature");
featureDefinitions.AddAttribute("Title", Name);
featureDefinitions.AddAttribute("Level", "1");
featureDefinitions.EndElement();
featureDefinitions.BeginElement("FeatureRef");
featureDefinitions.AddAttribute("Id", "ProductFeature");
AddDirectoryAndFileDefinitons(
toplevel, "INSTALL_ROOT",
directoryDefinitions, fileDefinitions, featureDefinitions,
directoryCounter, fileCounter);
featureDefinitions.EndElement();
featureDefinitions.EndElement();
fileDefinitions.EndElement();
for(size_t i = 1; i < install_root.size(); ++i)
{
directoryDefinitions.EndElement();
}
directoryDefinitions.EndElement();
directoryDefinitions.EndElement();
directoryDefinitions.EndElement();
std::string wixTemplate = FindTemplate("WIX.template.in");
if(wixTemplate.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Could not find CPack WiX template file WIX.template.in" << std::endl);
return false;
}
std::string mainSourceFilePath = cpackTopLevel + "/main.wxs";
if(!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath .c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Failed creating '" << mainSourceFilePath <<
"'' from template." << std::endl);
return false;
}
wixSources.push_back(mainSourceFilePath);
return true;
}
bool cmCPackWIXGenerator::CreateLicenseFile()
{
std::string licenseSourceFilename;
if(!RequireOption("CPACK_RESOURCE_FILE_LICENSE", licenseSourceFilename))
{
return false;
}
std::string licenseDestinationFilename;
if(!RequireOption("CPACK_WIX_LICENSE_RTF", licenseDestinationFilename))
{
return false;
}
std::string extension = GetRightmostExtension(licenseSourceFilename);
if(extension == ".rtf")
{
cmSystemTools::CopyAFile(
licenseSourceFilename.c_str(),
licenseDestinationFilename.c_str());
}
else if(extension == ".txt")
{
cmWIXRichTextFormatWriter rtfWriter(licenseDestinationFilename);
std::ifstream licenseSource(licenseSourceFilename.c_str());
std::string line;
while(std::getline(licenseSource, line))
{
rtfWriter.AddText(line);
rtfWriter.AddText("\n");
}
}
else
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"unsupported WiX License file extension '" <<
extension << "'" << std::endl);
return false;
}
return true;
}
void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
const std::string& topdir,
const std::string& directoryId,
cmWIXSourceWriter& directoryDefinitions,
cmWIXSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions,
size_t& directoryCounter,
size_t& fileCounter)
{
cmsys::Directory dir;
dir.Load(topdir.c_str());
for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i)
{
std::string fileName = dir.GetFile(static_cast<unsigned long>(i));
if(fileName == "." || fileName == "..")
{
continue;
}
std::string fullPath = topdir + "/" + fileName;
if(cmSystemTools::FileIsDirectory(fullPath.c_str()))
{
std::stringstream tmp;
tmp << "DIR_ID_" << ++directoryCounter;
std::string subDirectoryId = tmp.str();
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", subDirectoryId);
directoryDefinitions.AddAttribute("Name", fileName);
AddDirectoryAndFileDefinitons(
fullPath, subDirectoryId,
directoryDefinitions,
fileDefinitions,
featureDefinitions,
directoryCounter,
fileCounter);
directoryDefinitions.EndElement();
}
else
{
std::stringstream tmp;
tmp << "_ID_" << ++fileCounter;
std::string idSuffix = tmp.str();
std::string componentId = std::string("CMP") + idSuffix;
std::string fileId = std::string("FILE") + idSuffix;
fileDefinitions.BeginElement("DirectoryRef");
fileDefinitions.AddAttribute("Id", directoryId);
fileDefinitions.BeginElement("Component");
fileDefinitions.AddAttribute("Id", componentId);
fileDefinitions.AddAttribute("Guid", "*");
fileDefinitions.BeginElement("File");
fileDefinitions.AddAttribute("Id", fileId);
fileDefinitions.AddAttribute("Source", fullPath);
fileDefinitions.AddAttribute("KeyPath", "yes");
fileDefinitions.EndElement();
fileDefinitions.EndElement();
fileDefinitions.EndElement();
featureDefinitions.BeginElement("ComponentRef");
featureDefinitions.AddAttribute("Id", componentId);
featureDefinitions.EndElement();
}
}
}
bool cmCPackWIXGenerator::RequireOption(
const std::string& name, std::string &value) const
{
const char* tmp = GetOption(name.c_str());
if(tmp)
{
value = tmp;
return true;
}
else
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Required variable " << name << " not set" << std::endl);
return false;
}
}
std::string cmCPackWIXGenerator::GetArchitecture() const
{
std::string void_p_size;
RequireOption("CPACK_WIX_SIZEOF_VOID_P", void_p_size);
if(void_p_size == "8")
{
return "x64";
}
else
{
return "x86";
}
}
std::string cmCPackWIXGenerator::GenerateGUID()
{
UUID guid;
UuidCreate(&guid);
unsigned char *tmp = 0;
UuidToString(&guid, &tmp);
std::string result(reinterpret_cast<char*>(tmp));
RpcStringFree(&tmp);
return cmSystemTools::UpperCase(result);
}
std::string cmCPackWIXGenerator::QuotePath(const std::string& path)
{
return std::string("\"") + path + '"';
}
std::string cmCPackWIXGenerator::GetRightmostExtension(
const std::string& filename)
{
std::string extension;
std::string::size_type i = filename.rfind(".");
if(i != std::string::npos)
{
extension = filename.substr(i);
}
return cmSystemTools::LowerCase(extension);
}

View File

@ -0,0 +1,101 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2012 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmCPackWIXGenerator_h
#define cmCPackWIXGenerator_h
#include <CPack/cmCPackGenerator.h>
#include <string>
#include <map>
class cmWIXSourceWriter;
/** \class cmCPackWIXGenerator
* \brief A generator for WIX files
*/
class cmCPackWIXGenerator : public cmCPackGenerator
{
public:
cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator);
protected:
virtual int InitializeInternal();
virtual int PackageFiles();
virtual const char* GetOutputExtension()
{
return ".msi";
}
virtual enum CPackSetDestdirSupport SupportsSetDestdir() const
{
return SETDESTDIR_UNSUPPORTED;
}
virtual bool SupportsAbsoluteDestination() const
{
return false;
}
virtual bool SupportsComponentInstallation() const
{
return false;
}
private:
bool InitializeWiXConfiguration();
bool PackageFilesImpl();
bool CreateWiXVariablesIncludeFile();
void CopyDefinition(
cmWIXSourceWriter &source, const std::string &name);
void AddDefinition(cmWIXSourceWriter& source,
const std::string& name, const std::string& value);
bool CreateWiXSourceFiles();
bool CreateLicenseFile();
bool RunWiXCommand(const std::string& command);
bool RunCandleCommand(
const std::string& sourceFile, const std::string& objectFile);
bool RunLightCommand(const std::string& objectFiles);
void AddDirectoryAndFileDefinitons(const std::string& topdir,
const std::string& directoryId,
cmWIXSourceWriter& directoryDefinitions,
cmWIXSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions,
size_t& directoryCounter,
size_t& fileCounter);
bool RequireOption(const std::string& name, std::string& value) const;
std::string GetArchitecture() const;
static std::string GenerateGUID();
static std::string QuotePath(const std::string& path);
static std::string GetRightmostExtension(const std::string& filename);
std::vector<std::string> wixSources;
};
#endif

View File

@ -0,0 +1,137 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2012 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmWIXRichTextFormatWriter.h"
#include <cmVersion.h>
cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter(
const std::string& filename):
file(filename.c_str(), std::ios::binary)
{
StartGroup();
WriteHeader();
WriteDocumentPrefix();
}
cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter()
{
EndGroup();
/* I haven't seen this in the RTF spec but
* wordpad terminates its RTF like this */
file << "\r\n";
file.put(0);
}
void cmWIXRichTextFormatWriter::AddText(const std::string& text)
{
typedef unsigned char rtf_byte_t;
for(size_t i = 0; i < text.size(); ++i)
{
rtf_byte_t c = rtf_byte_t(text[i]);
switch(c)
{
case '\\':
file << "\\\\";
break;
case '{':
file << "\\{";
break;
case '}':
file << "\\}";
break;
case '\n':
file << "\\par\r\n";
break;
case '\r':
continue;
default:
{
if(c <= 0x7F)
{
file << c;
}
else
{
file << "[NON-ASCII-" << int(c) << "]";
}
}
break;
}
}
}
void cmWIXRichTextFormatWriter::WriteHeader()
{
ControlWord("rtf1");
ControlWord("ansi");
ControlWord("ansicpg1252");
ControlWord("deff0");
ControlWord("deflang1031");
WriteFontTable();
WriteGenerator();
}
void cmWIXRichTextFormatWriter::WriteFontTable()
{
StartGroup();
ControlWord("fonttbl");
StartGroup();
ControlWord("f0");
ControlWord("fswiss");
ControlWord("fcharset0 Arial;");
EndGroup();
EndGroup();
}
void cmWIXRichTextFormatWriter::WriteGenerator()
{
StartGroup();
NewControlWord("generator");
file << " CPack WiX Generator (" << cmVersion::GetCMakeVersion() << ");";
EndGroup();
}
void cmWIXRichTextFormatWriter::WriteDocumentPrefix()
{
ControlWord("viewkind4");
ControlWord("uc1");
ControlWord("pard");
ControlWord("f0");
ControlWord("fs20");
}
void cmWIXRichTextFormatWriter::ControlWord(const std::string& keyword)
{
file << "\\" << keyword;
}
void cmWIXRichTextFormatWriter::NewControlWord(const std::string& keyword)
{
file << "\\*\\" << keyword;
}
void cmWIXRichTextFormatWriter::StartGroup()
{
file.put('{');
}
void cmWIXRichTextFormatWriter::EndGroup()
{
file.put('}');
}

View File

@ -0,0 +1,46 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2012 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXRichTextFormatWriter_h
#define cmWIXRichTextFormatWriter_h
#include <fstream>
/** \class cmWIXRichtTextFormatWriter
* \brief Helper class to generate Rich Text Format (RTF) documents
* from plain text (e.g. for license and welcome text)
*/
class cmWIXRichTextFormatWriter
{
public:
cmWIXRichTextFormatWriter(const std::string& filename);
~cmWIXRichTextFormatWriter();
void AddText(const std::string& text);
private:
void WriteHeader();
void WriteFontTable();
void WriteGenerator();
void WriteDocumentPrefix();
void ControlWord(const std::string& keyword);
void NewControlWord(const std::string& keyword);
void StartGroup();
void EndGroup();
std::ofstream file;
};
#endif

View File

@ -0,0 +1,189 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmWIXSourceWriter.h"
#include <CPack/cmCPackGenerator.h>
#include <windows.h>
cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
const std::string& filename,
bool isIncludeFile):
Logger(logger),
file(filename.c_str()),
state(DEFAULT)
{
WriteXMLDeclaration();
if(isIncludeFile)
{
BeginElement("Include");
}
else
{
BeginElement("Wix");
}
AddAttribute("xmlns", "http://schemas.microsoft.com/wix/2006/wi");
}
cmWIXSourceWriter::~cmWIXSourceWriter()
{
while(elements.size())
{
EndElement();
}
}
void cmWIXSourceWriter::BeginElement(const std::string& name)
{
if(state == BEGIN)
{
file << ">";
}
file << "\n";
Indent(elements.size());
file << "<" << name;
elements.push_back(name);
state = BEGIN;
}
void cmWIXSourceWriter::EndElement()
{
if(elements.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"can not end WiX element with no open elements" << std::endl);
return;
}
if(state == DEFAULT)
{
file << "\n";
Indent(elements.size()-1);
file << "</" << elements.back() << ">";
}
else
{
file << "/>";
}
elements.pop_back();
state = DEFAULT;
}
void cmWIXSourceWriter::AddProcessingInstruction(
const std::string& target, const std::string& content)
{
if(state == BEGIN)
{
file << ">";
}
file << "\n";
Indent(elements.size());
file << "<?" << target << " " << content << "?>";
state = DEFAULT;
}
void cmWIXSourceWriter::AddAttribute(
const std::string& key, const std::string& value)
{
std::string utf8 = WindowsCodepageToUtf8(value);
file << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"';
}
std::string cmWIXSourceWriter::WindowsCodepageToUtf8(const std::string& value)
{
if(value.empty())
{
return std::string();
}
int characterCount = MultiByteToWideChar(
CP_ACP, 0, value.c_str(), static_cast<int>(value.size()), 0, 0);
if(characterCount == 0)
{
return std::string();
}
std::vector<wchar_t> utf16(characterCount);
MultiByteToWideChar(
CP_ACP, 0, value.c_str(), static_cast<int>(value.size()),
&utf16[0], static_cast<int>(utf16.size()));
int utf8ByteCount = WideCharToMultiByte(
CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()), 0, 0, 0, 0);
if(utf8ByteCount == 0)
{
return std::string();
}
std::vector<char> utf8(utf8ByteCount);
WideCharToMultiByte(CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()),
&utf8[0], static_cast<int>(utf8.size()), 0, 0);
return std::string(&utf8[0], utf8.size());
}
void cmWIXSourceWriter::WriteXMLDeclaration()
{
file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
}
void cmWIXSourceWriter::Indent(size_t count)
{
for(size_t i = 0; i < count; ++i)
{
file << " ";
}
}
std::string cmWIXSourceWriter::EscapeAttributeValue(
const std::string& value)
{
std::string result;
result.reserve(value.size());
char c = 0;
for(size_t i = 0 ; i < value.size(); ++i)
{
c = value[i];
switch(c)
{
case '<':
result += "&lt;";
break;
case '&':
result +="&amp;";
break;
case '"':
result += "&quot;";
break;
default:
result += c;
break;
}
}
return result;
}

View File

@ -0,0 +1,67 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXSourceWriter_h
#define cmWIXSourceWriter_h
#include <vector>
#include <string>
#include <fstream>
#include <CPack/cmCPackLog.h>
/** \class cmWIXSourceWriter
* \brief Helper class to generate XML WiX source files
*/
class cmWIXSourceWriter
{
public:
cmWIXSourceWriter(cmCPackLog* logger,
const std::string& filename, bool isIncludeFile = false);
~cmWIXSourceWriter();
void BeginElement(const std::string& name);
void EndElement();
void AddProcessingInstruction(
const std::string& target, const std::string& content);
void AddAttribute(
const std::string& key, const std::string& value);
static std::string WindowsCodepageToUtf8(const std::string& value);
private:
enum State
{
DEFAULT,
BEGIN
};
void WriteXMLDeclaration();
void Indent(size_t count);
static std::string EscapeAttributeValue(const std::string& value);
cmCPackLog* Logger;
std::ofstream file;
State state;
std::vector<std::string> elements;
};
#endif

View File

@ -23,7 +23,6 @@
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx> #include <cmsys/Glob.hxx>
#include <memory> // auto_ptr
#include <algorithm> #include <algorithm>
#if defined(__HAIKU__) #if defined(__HAIKU__)
@ -696,7 +695,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.SetProgressCallback(cmCPackGeneratorProgress, this); cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg; cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm); gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
std::string realInstallDirectory = tempInstallDirectory; std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" ) if ( !installSubDirectory.empty() && installSubDirectory != "/" )

View File

@ -19,6 +19,7 @@
#include "cmCPackZIPGenerator.h" #include "cmCPackZIPGenerator.h"
#include "cmCPackSTGZGenerator.h" #include "cmCPackSTGZGenerator.h"
#include "cmCPackNSISGenerator.h" #include "cmCPackNSISGenerator.h"
#ifdef __APPLE__ #ifdef __APPLE__
# include "cmCPackDragNDropGenerator.h" # include "cmCPackDragNDropGenerator.h"
# include "cmCPackBundleGenerator.h" # include "cmCPackBundleGenerator.h"
@ -32,11 +33,14 @@
#endif #endif
#if !defined(_WIN32) \ #if !defined(_WIN32) \
&& !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__)
# include "cmCPackDebGenerator.h" # include "cmCPackDebGenerator.h"
# include "cmCPackRPMGenerator.h" # include "cmCPackRPMGenerator.h"
#endif #endif
#ifdef _WIN32
# include "WiX/cmCPackWIXGenerator.h"
#endif
#include "cmCPackLog.h" #include "cmCPackLog.h"
@ -61,6 +65,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
{ {
this->RegisterGenerator("NSIS", "Null Soft Installer", this->RegisterGenerator("NSIS", "Null Soft Installer",
cmCPackNSISGenerator::CreateGenerator); cmCPackNSISGenerator::CreateGenerator);
this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)",
cmCPackNSISGenerator::CreateGenerator64);
} }
#ifdef __CYGWIN__ #ifdef __CYGWIN__
if (cmCPackCygwinBinaryGenerator::CanGenerate()) if (cmCPackCygwinBinaryGenerator::CanGenerate())
@ -80,6 +86,13 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("ZIP", "ZIP file format", this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackZIPGenerator::CreateGenerator); cmCPackZIPGenerator::CreateGenerator);
} }
#ifdef _WIN32
if (cmCPackWIXGenerator::CanGenerate())
{
this->RegisterGenerator("WIX", "MSI file format via WiX tools",
cmCPackWIXGenerator::CreateGenerator);
}
#endif
if (cmCPackTarBZip2Generator::CanGenerate()) if (cmCPackTarBZip2Generator::CanGenerate())
{ {
this->RegisterGenerator("TBZ2", "Tar BZip2 compression", this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
@ -113,7 +126,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
} }
#endif #endif
#if !defined(_WIN32) \ #if !defined(_WIN32) \
&& !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__)
if (cmCPackDebGenerator::CanGenerate()) if (cmCPackDebGenerator::CanGenerate())
{ {
this->RegisterGenerator("DEB", "Debian packages", this->RegisterGenerator("DEB", "Debian packages",

View File

@ -33,8 +33,9 @@
#endif #endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackNSISGenerator::cmCPackNSISGenerator() cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64)
{ {
Nsis64 = nsis64;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -359,6 +360,21 @@ int cmCPackNSISGenerator::InitializeInternal()
bool gotRegValue = false; bool gotRegValue = false;
#ifdef _WIN32 #ifdef _WIN32
if (Nsis64)
{
if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
cmsys::SystemTools::KeyWOW64_64) )
{
gotRegValue = true;
}
if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
cmsys::SystemTools::KeyWOW64_64) )
{
gotRegValue = true;
}
}
if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
cmsys::SystemTools::KeyWOW64_32) ) cmsys::SystemTools::KeyWOW64_32) )

View File

@ -27,10 +27,13 @@ class cmCPackNSISGenerator : public cmCPackGenerator
public: public:
cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator); cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
static cmCPackGenerator* CreateGenerator64()
{ return new cmCPackNSISGenerator(true); }
/** /**
* Construct generator * Construct generator
*/ */
cmCPackNSISGenerator(); cmCPackNSISGenerator(bool nsis64 = false);
virtual ~cmCPackNSISGenerator(); virtual ~cmCPackNSISGenerator();
protected: protected:
@ -77,6 +80,8 @@ protected:
/// Translations any newlines found in the string into \\r\\n, so that the /// Translations any newlines found in the string into \\r\\n, so that the
/// resulting string can be used within NSIS. /// resulting string can be used within NSIS.
static std::string TranslateNewlines(std::string str); static std::string TranslateNewlines(std::string str);
bool Nsis64;
}; };
#endif #endif

View File

@ -27,7 +27,6 @@
#include <cmsys/CommandLineArguments.hxx> #include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <memory> // auto_ptr
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const char * cmDocumentationName[][3] = static const char * cmDocumentationName[][3] =
@ -276,7 +275,7 @@ int main (int argc, char *argv[])
cminst.RemoveUnscriptableCommands(); cminst.RemoveUnscriptableCommands();
cmGlobalGenerator cmgg; cmGlobalGenerator cmgg;
cmgg.SetCMakeInstance(&cminst); cmgg.SetCMakeInstance(&cminst);
std::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
cmMakefile* globalMF = cmlg->GetMakefile(); cmMakefile* globalMF = cmlg->GetMakefile();
bool cpackConfigFileSpecified = true; bool cpackConfigFileSpecified = true;

View File

@ -1097,10 +1097,17 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
} }
else else
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, // gcov 4.7 can have output lines saying "No executable lines" and
"Unknown gcov output line: [" << line->c_str() << "]" << std::endl); // "Removing 'filename.gcov'"... Don't log those as "errors."
cont->Error ++; if(*line != "No executable lines" &&
//abort(); !cmSystemTools::StringStartsWith(line->c_str(), "Removing "))
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Unknown gcov output line: [" << line->c_str() << "]"
<< std::endl);
cont->Error ++;
//abort();
}
} }

View File

@ -248,7 +248,12 @@ bool cmCTestMultiProcessHandler::StartTest(int test)
//--------------------------------------------------------- //---------------------------------------------------------
void cmCTestMultiProcessHandler::StartNextTests() void cmCTestMultiProcessHandler::StartNextTests()
{ {
size_t numToStart = this->ParallelLevel - this->RunningCount; size_t numToStart = 0;
if(this->RunningCount < this->ParallelLevel)
{
numToStart = this->ParallelLevel - this->RunningCount;
}
if(numToStart == 0) if(numToStart == 0)
{ {
return; return;

View File

@ -32,7 +32,6 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include <memory> // auto_ptr
#include <set> #include <set>
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1547,7 +1546,7 @@ void cmCTestTestHandler::GetListOfTests()
cmake cm; cmake cm;
cmGlobalGenerator gg; cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm); gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE", mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str()); this->CTest->GetConfigType().c_str());

View File

@ -134,6 +134,10 @@ public:
"They may contain custom commands generating such sources, but not " "They may contain custom commands generating such sources, but not "
"PRE_BUILD, PRE_LINK, or POST_BUILD commands. " "PRE_BUILD, PRE_LINK, or POST_BUILD commands. "
"Object libraries cannot be imported, exported, installed, or linked." "Object libraries cannot be imported, exported, installed, or linked."
" "
"Some native build systems may not like targets that have only "
"object files, so consider adding at least one real source file "
"to any target that references $<TARGET_OBJECTS:objlib>."
; ;
} }

View File

@ -89,6 +89,7 @@
#include "cmStringCommand.cxx" #include "cmStringCommand.cxx"
#include "cmSubdirCommand.cxx" #include "cmSubdirCommand.cxx"
#include "cmTargetLinkLibrariesCommand.cxx" #include "cmTargetLinkLibrariesCommand.cxx"
#include "cmTimestamp.cxx"
#include "cmTryCompileCommand.cxx" #include "cmTryCompileCommand.cxx"
#include "cmTryRunCommand.cxx" #include "cmTryRunCommand.cxx"
#include "cmUnsetCommand.cxx" #include "cmUnsetCommand.cxx"

View File

@ -53,7 +53,7 @@
#include <cm_zlib.h> #include <cm_zlib.h>
#include <cmsys/Base64.h> #include <cmsys/Base64.h>
#if defined(__BEOS__) && !defined(__HAIKU__) #if defined(__BEOS__)
#include <be/kernel/OS.h> /* disable_debugger() API. */ #include <be/kernel/OS.h> /* disable_debugger() API. */
#endif #endif

View File

@ -279,7 +279,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_ #ifndef YY_
# if YYENABLE_NLS # if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS # if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid) # define YY_(msgid) dgettext ("bison-runtime", msgid)
@ -701,7 +701,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */ we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \ (Loc).first_line, (Loc).first_column, \

View File

@ -28,6 +28,9 @@
#include "cmRemoveDefinitionsCommand.cxx" #include "cmRemoveDefinitionsCommand.cxx"
#include "cmSourceGroupCommand.cxx" #include "cmSourceGroupCommand.cxx"
#include "cmSubdirDependsCommand.cxx" #include "cmSubdirDependsCommand.cxx"
#include "cmTargetCompileDefinitionsCommand.cxx"
#include "cmTargetIncludeDirectoriesCommand.cxx"
#include "cmTargetPropCommandBase.cxx"
#include "cmUseMangledMesaCommand.cxx" #include "cmUseMangledMesaCommand.cxx"
#include "cmUtilitySourceCommand.cxx" #include "cmUtilitySourceCommand.cxx"
#include "cmVariableRequiresCommand.cxx" #include "cmVariableRequiresCommand.cxx"
@ -66,6 +69,8 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmRemoveDefinitionsCommand); commands.push_back(new cmRemoveDefinitionsCommand);
commands.push_back(new cmSourceGroupCommand); commands.push_back(new cmSourceGroupCommand);
commands.push_back(new cmSubdirDependsCommand); commands.push_back(new cmSubdirDependsCommand);
commands.push_back(new cmTargetIncludeDirectoriesCommand);
commands.push_back(new cmTargetCompileDefinitionsCommand);
commands.push_back(new cmUseMangledMesaCommand); commands.push_back(new cmUseMangledMesaCommand);
commands.push_back(new cmUtilitySourceCommand); commands.push_back(new cmUtilitySourceCommand);
commands.push_back(new cmVariableRequiresCommand); commands.push_back(new cmVariableRequiresCommand);

View File

@ -172,10 +172,11 @@ satisfy dependencies.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmComputeLinkDepends cmComputeLinkDepends
::cmComputeLinkDepends(cmTarget* target, const char* config) ::cmComputeLinkDepends(cmTarget* target, const char* config, cmTarget* head)
{ {
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->HeadTarget = head;
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->LocalGenerator = this->Makefile->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
@ -352,7 +353,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
{ {
// Follow the target dependencies. // Follow the target dependencies.
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config)) entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
{ {
// This target provides its own link interface information. // This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries); this->AddLinkEntries(depender_index, iface->Libraries);
@ -444,7 +445,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
if(entry.Target) if(entry.Target)
{ {
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config)) entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
{ {
// Follow public and private dependencies transitively. // Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true); this->FollowSharedDeps(index, iface, true);
@ -533,7 +534,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
{ {
// Add direct link dependencies in this configuration. // Add direct link dependencies in this configuration.
cmTarget::LinkImplementation const* impl = cmTarget::LinkImplementation const* impl =
this->Target->GetLinkImplementation(this->Config); this->Target->GetLinkImplementation(this->Config, this->HeadTarget);
this->AddLinkEntries(-1, impl->Libraries); this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
wi = impl->WrongConfigLibraries.begin(); wi = impl->WrongConfigLibraries.begin();
@ -944,7 +945,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
if(cmTarget* target = this->EntryList[*ni].Target) if(cmTarget* target = this->EntryList[*ni].Target)
{ {
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
target->GetLinkInterface(this->Config)) target->GetLinkInterface(this->Config, this->HeadTarget))
{ {
if(iface->Multiplicity > count) if(iface->Multiplicity > count)
{ {

View File

@ -32,7 +32,7 @@ class cmake;
class cmComputeLinkDepends class cmComputeLinkDepends
{ {
public: public:
cmComputeLinkDepends(cmTarget* target, const char* config); cmComputeLinkDepends(cmTarget* target, const char* config, cmTarget *head);
~cmComputeLinkDepends(); ~cmComputeLinkDepends();
// Basic information about each link item. // Basic information about each link item.
@ -59,6 +59,7 @@ private:
// Context information. // Context information.
cmTarget* Target; cmTarget* Target;
cmTarget* HeadTarget;
cmMakefile* Makefile; cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator; cmLocalGenerator* LocalGenerator;
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;

View File

@ -239,10 +239,12 @@ because this need be done only for shared libraries without soname-s.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmComputeLinkInformation cmComputeLinkInformation
::cmComputeLinkInformation(cmTarget* target, const char* config) ::cmComputeLinkInformation(cmTarget* target, const char* config,
cmTarget *headTarget)
{ {
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->HeadTarget = headTarget;
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->LocalGenerator = this->Makefile->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
@ -265,7 +267,7 @@ cmComputeLinkInformation
this->OrderDependentRPath = 0; this->OrderDependentRPath = 0;
// Get the language used for linking this target. // Get the language used for linking this target.
this->LinkLanguage = this->Target->GetLinkerLanguage(config); this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget);
if(!this->LinkLanguage) if(!this->LinkLanguage)
{ {
// The Compute method will do nothing, so skip the rest of the // The Compute method will do nothing, so skip the rest of the
@ -503,7 +505,7 @@ bool cmComputeLinkInformation::Compute()
} }
// Compute the ordered link line items. // Compute the ordered link line items.
cmComputeLinkDepends cld(this->Target, this->Config); cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget);
cld.SetOldLinkDirMode(this->OldLinkDirMode); cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
@ -569,7 +571,8 @@ bool cmComputeLinkInformation::Compute()
void cmComputeLinkInformation::AddImplicitLinkInfo() void cmComputeLinkInformation::AddImplicitLinkInfo()
{ {
// The link closure lists all languages whose implicit info is needed. // The link closure lists all languages whose implicit info is needed.
cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config); cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config,
this->HeadTarget);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li) li != lc->Languages.end(); ++li)
{ {
@ -1376,10 +1379,31 @@ void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmComputeLinkInformation::ComputeFrameworkInfo() void cmComputeLinkInformation::ComputeFrameworkInfo()
{ {
// Avoid adding system framework paths. See "man ld" on OS X. // Avoid adding implicit framework paths.
this->FrameworkPathsEmmitted.insert("/Library/Frameworks"); std::vector<std::string> implicitDirVec;
this->FrameworkPathsEmmitted.insert("/Network/Library/Frameworks");
this->FrameworkPathsEmmitted.insert("/System/Library/Frameworks"); // Get platform-wide implicit directories.
if(const char* implicitLinks = this->Makefile->GetDefinition
("CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"))
{
cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
}
// Get language-specific implicit directories.
std::string implicitDirVar = "CMAKE_";
implicitDirVar += this->LinkLanguage;
implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES";
if(const char* implicitDirs =
this->Makefile->GetDefinition(implicitDirVar.c_str()))
{
cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
}
for(std::vector<std::string>::const_iterator i = implicitDirVec.begin();
i != implicitDirVec.end(); ++i)
{
this->FrameworkPathsEmmitted.insert(*i);
}
// Regular expression to extract a framework path and name. // Regular expression to extract a framework path and name.
this->SplitFramework.compile("(.*)/(.*)\\.framework$"); this->SplitFramework.compile("(.*)/(.*)\\.framework$");

View File

@ -29,7 +29,8 @@ class cmOrderDirectories;
class cmComputeLinkInformation class cmComputeLinkInformation
{ {
public: public:
cmComputeLinkInformation(cmTarget* target, const char* config); cmComputeLinkInformation(cmTarget* target, const char* config,
cmTarget* headTarget);
~cmComputeLinkInformation(); ~cmComputeLinkInformation();
bool Compute(); bool Compute();
@ -74,6 +75,7 @@ private:
// Context information. // Context information.
cmTarget* Target; cmTarget* Target;
cmTarget* HeadTarget;
cmMakefile* Makefile; cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator; cmLocalGenerator* LocalGenerator;
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;

View File

@ -200,20 +200,48 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Get the depender. // Get the depender.
cmTarget* depender = this->Targets[depender_index]; cmTarget* depender = this->Targets[depender_index];
// Loop over all targets linked directly. // Loop over all targets linked directly in all configs.
// We need to make targets depend on the union of all config-specific
// dependencies in all targets, because the generated build-systems can't
// deal with config-specific dependencies.
{ {
cmTarget::LinkLibraryVectorType const& tlibs =
depender->GetOriginalLinkLibraries();
std::set<cmStdString> emitted; std::set<cmStdString> emitted;
{
std::vector<std::string> tlibs;
depender->GetDirectLinkLibraries(0, tlibs, depender);
// A target should not depend on itself. // A target should not depend on itself.
emitted.insert(depender->GetName()); emitted.insert(depender->GetName());
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); for(std::vector<std::string>::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib) lib != tlibs.end(); ++lib)
{ {
// Don't emit the same library twice for this target. // Don't emit the same library twice for this target.
if(emitted.insert(lib->first).second) if(emitted.insert(*lib).second)
{ {
this->AddTargetDepend(depender_index, lib->first.c_str(), true); this->AddTargetDepend(depender_index, lib->c_str(), true);
this->AddInterfaceDepends(depender_index, lib->c_str(),
true, emitted);
}
}
}
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
std::vector<std::string> tlibs;
depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib)
{
// Don't emit the same library twice for this target.
if(emitted.insert(*lib).second)
{
this->AddTargetDepend(depender_index, lib->c_str(), true);
this->AddInterfaceDepends(depender_index, lib->c_str(),
true, emitted);
}
} }
} }
} }
@ -236,6 +264,64 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
} }
} }
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
cmTarget* dependee,
const char *config,
std::set<cmStdString> &emitted)
{
cmTarget* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
dependee->GetLinkInterface(config, depender))
{
for(std::vector<std::string>::const_iterator
lib = iface->Libraries.begin();
lib != iface->Libraries.end(); ++lib)
{
// Don't emit the same library twice for this target.
if(emitted.insert(*lib).second)
{
this->AddTargetDepend(depender_index, lib->c_str(), true);
}
}
}
}
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
const char* dependee_name,
bool linking,
std::set<cmStdString> &emitted)
{
cmTarget* depender = this->Targets[depender_index];
cmTarget* dependee =
depender->GetMakefile()->FindTargetToUse(dependee_name);
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if(linking && dependee &&
dependee->GetType() == cmTarget::EXECUTABLE &&
!dependee->IsExecutableWithExports())
{
dependee = 0;
}
if(dependee)
{
this->AddInterfaceDepends(depender_index, dependee, 0, emitted);
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
// A target should not depend on itself.
emitted.insert(depender->GetName());
this->AddInterfaceDepends(depender_index, dependee,
it->c_str(), emitted);
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index, void cmComputeTargetDepends::AddTargetDepend(int depender_index,
const char* dependee_name, const char* dependee_name,

View File

@ -48,7 +48,11 @@ private:
bool linking); bool linking);
void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking); void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
void AddInterfaceDepends(int depender_index, const char* dependee_name,
bool linking, std::set<cmStdString> &emitted);
void AddInterfaceDepends(int depender_index, cmTarget* dependee,
const char *config,
std::set<cmStdString> &emitted);
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;
bool DebugMode; bool DebugMode;
bool NoCycles; bool NoCycles;

View File

@ -47,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
{ {
return target->GetLocation(this->Config); return target->GetLocation(this->Config);
} }
return this->GE->Parse(argv0).Evaluate(this->Makefile, this->Config); return this->GE->Parse(argv0)->Evaluate(this->Makefile, this->Config);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -58,7 +58,7 @@ cmCustomCommandGenerator
cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c];
for(unsigned int j=1;j < commandLine.size(); ++j) for(unsigned int j=1;j < commandLine.size(); ++j)
{ {
std::string arg = this->GE->Parse(commandLine[j]).Evaluate(this->Makefile, std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->Makefile,
this->Config); this->Config);
cmd += " "; cmd += " ";
if(this->OldStyle) if(this->OldStyle)

View File

@ -26,6 +26,16 @@
"strings which contain a '>' for example.\n" \ "strings which contain a '>' for example.\n" \
" $<COMMA> = A literal ','. Used to compare " \ " $<COMMA> = A literal ','. Used to compare " \
"strings which contain a ',' for example.\n" \ "strings which contain a ',' for example.\n" \
" $<TARGET_NAME:...> = Marks ... as being the name of a " \
"target. This is required if exporting targets to multiple " \
"dependent export sets. The '...' must be a literal name of a " \
"target- it may not contain generator expressions.\n" \
" $<INSTALL_INTERFACE:...> = content of \"...\" when the property " \
"is exported using install(EXPORT), and empty otherwise.\n" \
" $<BUILD_INTERFACE:...> = content of \"...\" when the property " \
"is exported using export(), or when the target is used by another " \
"target in the same buildsystem. Expands to the empty string " \
"otherwise.\n" \
" $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n" \ " $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n" \
" $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n" \ " $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n" \
" $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)\n" \ " $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)\n" \

View File

@ -896,6 +896,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
" script, it may get fatal error messages from the script.",false, " script, it may get fatal error messages from the script.",false,
"Variables That Change Behavior"); "Variables That Change Behavior");
cm->DefineProperty
("CMAKE_DEBUG_TARGET_PROPERTIES", cmProperty::VARIABLE,
"Enables tracing output for target properties.",
"This variable can be populated with a list of properties to generate "
"debug output for when evaluating target properties. Currently it can "
"only be used when evaluating the INCLUDE_DIRECTORIES target property. "
"In that case, it outputs a backtrace for each include directory in "
"the build. Default is unset.",false,"Variables That Change Behavior");
cm->DefineProperty cm->DefineProperty
("CMAKE_SUBLIMECLANG_DISABLED", cmProperty::VARIABLE, ("CMAKE_SUBLIMECLANG_DISABLED", cmProperty::VARIABLE,
"Used by the Sublime Text 2 generator to disable SublimeClang in " "Used by the Sublime Text 2 generator to disable SublimeClang in "
@ -1146,6 +1154,17 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
false, false,
"Variables that Control the Build"); "Variables that Control the Build");
cm->DefineProperty
("CMAKE_BUILD_INTERFACE_INCLUDES", cmProperty::VARIABLE,
"Automatically add the current source- and build directories "
"to the INTERFACE_INCLUDE_DIRECTORIES.",
"If this variable is enabled, CMake automatically adds for each "
"target ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} "
"to the INTERFACE_INCLUDE_DIRECTORIES."
"By default CMAKE_BUILD_INTERFACE_INCLUDES is OFF.",
false,
"Variables that Control the Build");
cm->DefineProperty cm->DefineProperty
("CMAKE_INSTALL_RPATH", cmProperty::VARIABLE, ("CMAKE_INSTALL_RPATH", cmProperty::VARIABLE,
"The rpath to use for installed targets.", "The rpath to use for installed targets.",
@ -1630,6 +1649,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"These paths are implicit linker search directories for the compiler's " "These paths are implicit linker search directories for the compiler's "
"language. " "language. "
"CMake automatically detects these directories for each language and " "CMake automatically detects these directories for each language and "
"reports the results in this variable."
"\n"
"When a library in one of these directories is given by full path to "
"target_link_libraries() CMake will generate the -l<name> form on "
"link lines to ensure the linker searches its implicit directories "
"for the library. "
"Note that some toolchains read implicit directories from an "
"environment variable such as LIBRARY_PATH so keep its value "
"consistent when operating in a given build tree.",false,
"Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", cmProperty::VARIABLE,
"Implicit linker framework search path detected for language <LANG>.",
"These paths are implicit linker framework search directories for "
"the compiler's language. "
"CMake automatically detects these directories for each language and "
"reports the results in this variable.", false, "reports the results in this variable.", false,
"Variables for Languages"); "Variables for Languages");

View File

@ -22,15 +22,20 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{ {
// Create all the imported targets. std::vector<cmTarget*> allTargets;
{
std::string expectedTargets;
std::string sep;
for(std::vector<cmTarget*>::const_iterator for(std::vector<cmTarget*>::const_iterator
tei = this->Exports->begin(); tei = this->Exports->begin();
tei != this->Exports->end(); ++tei) tei != this->Exports->end(); ++tei)
{ {
expectedTargets += sep + this->Namespace + (*tei)->GetName();
sep = " ";
cmTarget* te = *tei; cmTarget* te = *tei;
if(this->ExportedTargets.insert(te).second) if(this->ExportedTargets.insert(te).second)
{ {
this->GenerateImportTargetCode(os, te); allTargets.push_back(te);
} }
else else
{ {
@ -44,6 +49,33 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
} }
} }
this->GenerateExpectedTargetsCode(os, expectedTargets);
}
std::vector<std::string> missingTargets;
// Create all the imported targets.
for(std::vector<cmTarget*>::const_iterator
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
cmTarget* te = *tei;
this->GenerateImportTargetCode(os, te);
ImportPropertyMap properties;
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te,
cmGeneratorExpression::BuildInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te,
cmGeneratorExpression::BuildInterface,
properties, missingTargets);
this->GenerateInterfaceProperties(te, os, properties);
}
this->GenerateMissingTargetsCheckCode(os, missingTargets);
// Generate import file content for each configuration. // Generate import file content for each configuration.
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ci = this->Configurations.begin(); ci = this->Configurations.begin();

View File

@ -124,6 +124,201 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
this->GenerateImportTargetsConfig(os, config, suffix); this->GenerateImportTargetsConfig(os, config, suffix);
} }
//----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
const char *outputName,
cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets)
{
const char *input = target->GetProperty(propName);
if (input)
{
if (!*input)
{
// Set to empty
properties[outputName] = "";
return;
}
std::string prepro = cmGeneratorExpression::Preprocess(input,
preprocessRule);
if (!prepro.empty())
{
this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets);
properties[outputName] = prepro;
}
}
}
//----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets)
{
this->PopulateInterfaceProperty(propName, propName, target, preprocessRule,
properties, missingTargets);
}
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget *target,
std::ostream& os,
const ImportPropertyMap &properties)
{
if (!properties.empty())
{
std::string targetName = this->Namespace;
targetName += target->GetName();
os << "SET_TARGET_PROPERTIES(" << targetName << " PROPERTIES\n";
for(ImportPropertyMap::const_iterator pi = properties.begin();
pi != properties.end(); ++pi)
{
os << " " << pi->first << " \"" << pi->second << "\"\n";
}
os << ")\n\n";
}
}
//----------------------------------------------------------------------------
void
cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
std::string &input,
cmTarget* target,
std::vector<std::string> &missingTargets)
{
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
cmMakefile *mf = target->GetMakefile();
std::string errorString;
while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos)
{
std::string::size_type nameStartPos = pos +
sizeof("$<TARGET_PROPERTY:") - 1;
std::string::size_type closePos = input.find(">", nameStartPos);
std::string::size_type commaPos = input.find(",", nameStartPos);
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
if (commaPos == input.npos // Implied 'this' target
|| closePos == input.npos // Imcomplete expression.
|| closePos < commaPos // Implied 'this' target
|| nextOpenPos < commaPos) // Non-literal
{
lastPos = nameStartPos;
continue;
}
const std::string targetName = input.substr(nameStartPos,
commaPos - nameStartPos);
pos = nameStartPos; // We're not going to replace the entire expression,
// but only the target parameter.
if (cmTarget *tgt = mf->FindTargetToUse(targetName.c_str()))
{
if(tgt->IsImported())
{
pos += targetName.size();
}
else if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
{
input.replace(pos, targetName.size(),
this->Namespace + targetName);
pos += this->Namespace.size() + targetName.size();
}
else
{
std::string namespacedTarget;
this->HandleMissingTarget(namespacedTarget, missingTargets,
mf, target, tgt);
if (!namespacedTarget.empty())
{
input.replace(pos, targetName.size(), namespacedTarget);
pos += namespacedTarget.size();
}
}
}
else
{
errorString = "$<TARGET_PROPERTY:" + targetName + ",prop> requires "
"its first parameter to be a reachable target.";
}
lastPos = pos;
if (!errorString.empty())
{
break;
}
}
if (!errorString.empty())
{
mf->IssueMessage(cmake::FATAL_ERROR, errorString);
return;
}
pos = 0;
lastPos = pos;
while((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos)
{
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
std::string::size_type endPos = input.find(">", nameStartPos);
if (endPos == input.npos)
{
errorString = "$<TARGET_NAME:...> expression incomplete";
}
const std::string targetName = input.substr(nameStartPos,
endPos - nameStartPos);
if(targetName.find("$<", lastPos) != input.npos)
{
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
"literal.";
}
if (cmTarget *tgt = mf->FindTargetToUse(targetName.c_str()))
{
if(tgt->IsImported())
{
input.replace(pos, sizeof("$<TARGET_NAME:") + targetName.size(),
targetName);
pos += sizeof("$<TARGET_NAME:") + targetName.size();
}
else if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
{
input.replace(pos, sizeof("$<TARGET_NAME:") + targetName.size(),
this->Namespace + targetName);
pos += sizeof("$<TARGET_NAME:") + targetName.size();
}
else
{
std::string namespacedTarget;
this->HandleMissingTarget(namespacedTarget, missingTargets,
mf, target, tgt);
if (!namespacedTarget.empty())
{
input.replace(pos, sizeof("$<TARGET_NAME:") + targetName.size(),
namespacedTarget);
pos += sizeof("$<TARGET_NAME:") + targetName.size();
}
}
}
else
{
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
"reachable target.";
}
lastPos = pos;
if (!errorString.empty())
{
break;
}
}
if (!errorString.empty())
{
mf->IssueMessage(cmake::FATAL_ERROR, errorString);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportFileGenerator cmExportFileGenerator
@ -162,7 +357,8 @@ cmExportFileGenerator
} }
// Add the transitive link dependencies for this configuration. // Add the transitive link dependencies for this configuration.
if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config)) if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config,
target))
{ {
this->SetImportLinkProperty(suffix, target, this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES", "IMPORTED_LINK_INTERFACE_LANGUAGES",
@ -286,6 +482,37 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
<< "\n"; << "\n";
} }
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
const std::string &expectedTargets)
{
os << "SET(_targetsDefined)\n"
"SET(_targetsNotDefined)\n"
"SET(_expectedTargets)\n"
"FOREACH(_expectedTarget " << expectedTargets << ")\n"
" LIST(APPEND _expectedTargets ${_expectedTarget})\n"
" IF(NOT TARGET ${_expectedTarget})\n"
" LIST(APPEND _targetsNotDefined ${_expectedTarget})\n"
" ENDIF(NOT TARGET ${_expectedTarget})\n"
" IF(TARGET ${_expectedTarget})\n"
" LIST(APPEND _targetsDefined ${_expectedTarget})\n"
" ENDIF(TARGET ${_expectedTarget})\n"
"ENDFOREACH(_expectedTarget)\n"
"IF(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
" SET(CMAKE_IMPORT_FILE_VERSION)\n"
" CMAKE_POLICY(POP)\n"
" RETURN()\n"
"ENDIF(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
"IF(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
" MESSAGE(FATAL_ERROR \"Some (but not all) targets in this export "
"set were already defined.\\nTargets Defined: ${_targetsDefined}\\n"
"Targets not yet defined: ${_targetsNotDefined}\\n\")\n"
"ENDIF(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
"UNSET(_targetsDefined)\n"
"UNSET(_targetsNotDefined)\n"
"UNSET(_expectedTargets)\n"
"\n\n";
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportFileGenerator cmExportFileGenerator

View File

@ -13,6 +13,7 @@
#define cmExportFileGenerator_h #define cmExportFileGenerator_h
#include "cmCommand.h" #include "cmCommand.h"
#include "cmGeneratorExpression.h"
/** \class cmExportFileGenerator /** \class cmExportFileGenerator
* \brief Generate a file exporting targets from a build or install tree. * \brief Generate a file exporting targets from a build or install tree.
@ -63,6 +64,8 @@ protected:
void GenerateMissingTargetsCheckCode(std::ostream& os, void GenerateMissingTargetsCheckCode(std::ostream& os,
const std::vector<std::string>& missingTargets); const std::vector<std::string>& missingTargets);
void GenerateExpectedTargetsCode(std::ostream& os,
const std::string &expectedTargets);
// Collect properties with detailed information about targets beyond // Collect properties with detailed information about targets beyond
// their location on disk. // their location on disk.
@ -91,6 +94,17 @@ protected:
cmMakefile* mf, cmMakefile* mf,
cmTarget* depender, cmTarget* depender,
cmTarget* dependee) = 0; cmTarget* dependee) = 0;
void PopulateInterfaceProperty(const char *,
cmTarget *target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
void GenerateInterfaceProperties(cmTarget *target, std::ostream& os,
const ImportPropertyMap &properties);
void ResolveTargetsInGeneratorExpressions(std::string &input,
cmTarget* target,
std::vector<std::string> &missingTargets);
// The namespace in which the exports are placed in the generated file. // The namespace in which the exports are placed in the generated file.
std::string Namespace; std::string Namespace;
@ -107,6 +121,13 @@ protected:
// The set of targets included in the export. // The set of targets included in the export.
std::set<cmTarget*> ExportedTargets; std::set<cmTarget*> ExportedTargets;
private:
void PopulateInterfaceProperty(const char *, const char *,
cmTarget *target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
}; };
#endif #endif

View File

@ -39,15 +39,20 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{ {
// Create all the imported targets. std::vector<cmTarget*> allTargets;
{
std::string expectedTargets;
std::string sep;
for(std::vector<cmTargetExport*>::const_iterator for(std::vector<cmTargetExport*>::const_iterator
tei = this->IEGen->GetExportSet()->GetTargetExports()->begin(); tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
{ {
expectedTargets += sep + this->Namespace + (*tei)->Target->GetName();
sep = " ";
cmTargetExport const* te = *tei; cmTargetExport const* te = *tei;
if(this->ExportedTargets.insert(te->Target).second) if(this->ExportedTargets.insert(te->Target).second)
{ {
this->GenerateImportTargetCode(os, te->Target); allTargets.push_back(te->Target);
} }
else else
{ {
@ -61,6 +66,35 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
} }
} }
this->GenerateExpectedTargetsCode(os, expectedTargets);
}
std::vector<std::string> missingTargets;
// Create all the imported targets.
for(std::vector<cmTarget*>::const_iterator
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
cmTarget* te = *tei;
this->GenerateImportTargetCode(os, te);
ImportPropertyMap properties;
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES",
te,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
te,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->GenerateInterfaceProperties(te, os, properties);
}
this->GenerateMissingTargetsCheckCode(os, missingTargets);
// Now load per-configuration properties for them. // Now load per-configuration properties for them.
os << "# Load information for each installed configuration.\n" os << "# Load information for each installed configuration.\n"
<< "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"

View File

@ -811,6 +811,11 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
command += " VERBOSE=1 "; command += " VERBOSE=1 ";
command += target; command += target;
} }
else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
{
command += " -v ";
command += target;
}
else else
{ {
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);

View File

@ -17,6 +17,8 @@
#include "cmFileTimeComparison.h" #include "cmFileTimeComparison.h"
#include "cmCryptoHash.h" #include "cmCryptoHash.h"
#include "cmTimestamp.h"
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_curl.h" #include "cm_curl.h"
#endif #endif
@ -161,6 +163,10 @@ bool cmFileCommand
{ {
return this->HandleCMakePathCommand(args, true); return this->HandleCMakePathCommand(args, true);
} }
else if ( subCommand == "TIMESTAMP" )
{
return this->HandleTimestampCommand(args);
}
std::string e = "does not recognize sub-command "+subCommand; std::string e = "does not recognize sub-command "+subCommand;
this->SetError(e.c_str()); this->SetError(e.c_str());
@ -3241,3 +3247,54 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
return false; return false;
#endif #endif
} }
//----------------------------------------------------------------------------
bool cmFileCommand::HandleTimestampCommand(
std::vector<std::string> const& args)
{
if(args.size() < 3)
{
this->SetError("sub-command TIMESTAMP requires at least two arguments.");
return false;
}
else if(args.size() > 5)
{
this->SetError("sub-command TIMESTAMP takes at most four arguments.");
return false;
}
unsigned int argsIndex = 1;
const std::string& filename = args[argsIndex++];
const std::string& outputVariable = args[argsIndex++];
std::string formatString;
if(args.size() > argsIndex && args[argsIndex] != "UTC")
{
formatString = args[argsIndex++];
}
bool utcFlag = false;
if(args.size() > argsIndex)
{
if(args[argsIndex] == "UTC")
{
utcFlag = true;
}
else
{
std::string e = " TIMESTAMP sub-command does not recognize option " +
args[argsIndex] + ".";
this->SetError(e.c_str());
return false;
}
}
cmTimestamp timestamp;
std::string result = timestamp.FileModificationTime(
filename.c_str(), formatString, utcFlag);
this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str());
return true;
}

View File

@ -87,6 +87,7 @@ public:
" [TLS_VERIFY on|off] [TLS_CAINFO file])\n" " [TLS_VERIFY on|off] [TLS_CAINFO file])\n"
" file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n"
" [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n"
" file(TIMESTAMP filename variable [<format string>] [UTC])\n"
"WRITE will write a message into a file called 'filename'. It " "WRITE will write a message into a file called 'filename'. It "
"overwrites the file if it already exists, and creates the file " "overwrites the file if it already exists, and creates the file "
"if it does not exist. (If the file is a build input, use " "if it does not exist. (If the file is a build input, use "
@ -200,6 +201,12 @@ public:
"If SHOW_PROGRESS is specified, progress information will be printed " "If SHOW_PROGRESS is specified, progress information will be printed "
"as status messages until the operation is complete." "as status messages until the operation is complete."
"\n" "\n"
"TIMESTAMP will write a string representation of "
"the modification time of filename to variable.\n"
"Should the command be unable to obtain a timestamp "
"variable will be set to the empty string \"\".\n"
"See documentation of the string TIMESTAMP sub-command for more details."
"\n"
"The file() command also provides COPY and INSTALL signatures:\n" "The file() command also provides COPY and INSTALL signatures:\n"
" file(<COPY|INSTALL> files... DESTINATION <dir>\n" " file(<COPY|INSTALL> files... DESTINATION <dir>\n"
" [FILE_PERMISSIONS permissions...]\n" " [FILE_PERMISSIONS permissions...]\n"
@ -260,6 +267,8 @@ protected:
bool HandleInstallCommand(std::vector<std::string> const& args); bool HandleInstallCommand(std::vector<std::string> const& args);
bool HandleDownloadCommand(std::vector<std::string> const& args); bool HandleDownloadCommand(std::vector<std::string> const& args);
bool HandleUploadCommand(std::vector<std::string> const& args); bool HandleUploadCommand(std::vector<std::string> const& args);
bool HandleTimestampCommand(std::vector<std::string> const& args);
}; };

View File

@ -360,13 +360,13 @@ void cmFindBase::AddPrefixPaths(std::vector<std::string> const& in_paths,
{ {
dir += "/"; dir += "/";
} }
if(subdir == "lib") if(subdir == "include" || subdir == "lib")
{ {
const char* arch = const char* arch =
this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE");
if(arch && *arch) if(arch && *arch)
{ {
this->AddPathInternal(dir+"lib/"+arch, pathType); this->AddPathInternal(dir+subdir+"/"+arch, pathType);
} }
} }
std::string add = dir + subdir; std::string add = dir + subdir;

View File

@ -45,8 +45,10 @@ void cmFindPathCommand::GenerateDocumentation()
"SEARCH_XXX", "file in a directory"); "SEARCH_XXX", "file in a directory");
cmSystemTools::ReplaceString(this->GenericDocumentation, cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SUBDIR", "include"); "XXX_SUBDIR", "include");
cmSystemTools::ReplaceString(this->GenericDocumentation, cmSystemTools::ReplaceString(
"XXX_EXTRA_PREFIX_ENTRY", ""); this->GenericDocumentation,
"XXX_EXTRA_PREFIX_ENTRY",
" <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and\n");
cmSystemTools::ReplaceString(this->GenericDocumentation, cmSystemTools::ReplaceString(this->GenericDocumentation,
"CMAKE_FIND_ROOT_PATH_MODE_XXX", "CMAKE_FIND_ROOT_PATH_MODE_XXX",
"CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"); "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE");

View File

@ -25,55 +25,55 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGeneratorExpression::cmGeneratorExpression( cmGeneratorExpression::cmGeneratorExpression(
cmListFileBacktrace const& backtrace): cmListFileBacktrace const& backtrace):
Backtrace(backtrace), CompiledExpression(0) Backtrace(backtrace)
{ {
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const cmCompiledGeneratorExpression & cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(std::string const& input) cmGeneratorExpression::Parse(std::string const& input)
{ {
return this->Parse(input.c_str()); return this->Parse(input.c_str());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const cmCompiledGeneratorExpression & cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(const char* input) cmGeneratorExpression::Parse(const char* input)
{ {
cmGeneratorExpressionLexer l; return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(input); new cmCompiledGeneratorExpression(
bool needsParsing = l.GetSawGeneratorExpression(); this->Backtrace,
std::vector<cmGeneratorExpressionEvaluator*> evaluators; input));
if (needsParsing)
{
cmGeneratorExpressionParser p(tokens);
p.Parse(evaluators);
}
delete this->CompiledExpression;
this->CompiledExpression = new cmCompiledGeneratorExpression(
this->Backtrace,
evaluators,
input,
needsParsing);
return *this->CompiledExpression;
} }
cmGeneratorExpression::~cmGeneratorExpression() cmGeneratorExpression::~cmGeneratorExpression()
{ {
delete this->CompiledExpression;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate( const char *cmCompiledGeneratorExpression::Evaluate(
cmMakefile* mf, const char* config, bool quiet, cmMakefile* mf, const char* config, bool quiet,
cmGeneratorTarget *target, cmTarget *headTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
return this->Evaluate(mf,
config,
quiet,
headTarget,
headTarget,
dagChecker);
}
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(
cmMakefile* mf, const char* config, bool quiet,
cmTarget *headTarget,
cmTarget *currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const cmGeneratorExpressionDAGChecker *dagChecker) const
{ {
if (!this->NeedsParsing) if (!this->NeedsParsing)
{ {
return this->Input; return this->Input.c_str();
} }
this->Output = ""; this->Output = "";
@ -88,12 +88,21 @@ const char *cmCompiledGeneratorExpression::Evaluate(
context.Config = config; context.Config = config;
context.Quiet = quiet; context.Quiet = quiet;
context.HadError = false; context.HadError = false;
context.Target = target; context.HeadTarget = headTarget;
context.CurrentTarget = currentTarget ? currentTarget : headTarget;
context.Backtrace = this->Backtrace; context.Backtrace = this->Backtrace;
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
this->Output += (*it)->Evaluate(&context, dagChecker); const std::string result = (*it)->Evaluate(&context, dagChecker);
this->Output += result;
for(std::set<cmStdString>::const_iterator
p = context.SeenTargetProperties.begin();
p != context.SeenTargetProperties.end(); ++p)
{
this->SeenTargetProperties[*p] += result + ";";
}
if (context.HadError) if (context.HadError)
{ {
this->Output = ""; this->Output = "";
@ -108,12 +117,19 @@ const char *cmCompiledGeneratorExpression::Evaluate(
cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
cmListFileBacktrace const& backtrace, cmListFileBacktrace const& backtrace,
const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, const char *input)
const char *input, bool needsParsing) : Backtrace(backtrace), Input(input ? input : "")
: Backtrace(backtrace), Evaluators(evaluators), Input(input),
NeedsParsing(needsParsing)
{ {
cmGeneratorExpressionLexer l;
std::vector<cmGeneratorExpressionToken> tokens =
l.Tokenize(this->Input.c_str());
this->NeedsParsing = l.GetSawGeneratorExpression();
if (this->NeedsParsing)
{
cmGeneratorExpressionParser p(tokens);
p.Parse(this->Evaluators);
}
} }
@ -131,15 +147,9 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
} }
} }
std::string cmGeneratorExpression::Preprocess(const std::string &input, //----------------------------------------------------------------------------
PreprocessContext context) static std::string stripAllGeneratorExpressions(const std::string &input)
{ {
if (context != StripAllGeneratorExpressions)
{
assert(!"cmGeneratorExpression::Preprocess called with invalid args");
return std::string();
}
std::string result; std::string result;
std::string::size_type pos = 0; std::string::size_type pos = 0;
std::string::size_type lastPos = pos; std::string::size_type lastPos = pos;
@ -178,3 +188,81 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input,
result += input.substr(lastPos); result += input.substr(lastPos);
return result; return result;
} }
//----------------------------------------------------------------------------
static std::string stripExportInterface(const std::string &input,
cmGeneratorExpression::PreprocessContext context)
{
std::string result;
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
while((pos = input.find("$<BUILD_INTERFACE:", lastPos)) != input.npos
|| (pos = input.find("$<INSTALL_INTERFACE:", lastPos)) != input.npos)
{
result += input.substr(lastPos, pos - lastPos);
const bool gotInstallInterface = input[pos + 2] == 'I';
pos += gotInstallInterface ? sizeof("$<INSTALL_INTERFACE:") - 1
: sizeof("$<BUILD_INTERFACE:") - 1;
int nestingLevel = 1;
const char *c = input.c_str() + pos;
const char * const cStart = c;
for ( ; *c; ++c)
{
if(c[0] == '$' && c[1] == '<')
{
++nestingLevel;
++c;
continue;
}
if(c[0] == '>')
{
--nestingLevel;
if (nestingLevel != 0)
{
continue;
}
if(context == cmGeneratorExpression::BuildInterface
&& !gotInstallInterface)
{
result += input.substr(pos, c - cStart);
}
else if(context == cmGeneratorExpression::InstallInterface
&& gotInstallInterface)
{
result += input.substr(pos, c - cStart);
}
break;
}
}
const std::string::size_type traversed = (c - cStart) + 1;
if (!*c)
{
result += std::string(gotInstallInterface ? "$<INSTALL_INTERFACE:"
: "$<BUILD_INTERFACE:")
+ input.substr(pos, traversed);
}
pos += traversed;
lastPos = pos;
}
result += input.substr(lastPos);
return result;
}
//----------------------------------------------------------------------------
std::string cmGeneratorExpression::Preprocess(const std::string &input,
PreprocessContext context)
{
if (context == StripAllGeneratorExpressions)
{
return stripAllGeneratorExpressions(input);
}
else if (context == BuildInterface || context == InstallInterface)
{
return stripExportInterface(input, context);
}
assert(!"cmGeneratorExpression::Preprocess called with invalid args");
return std::string();
}

View File

@ -14,13 +14,14 @@
#define cmGeneratorExpression_h #define cmGeneratorExpression_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmListFileCache.h"
#include <stack> #include <stack>
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
#include <cmsys/auto_ptr.hxx>
class cmTarget; class cmTarget;
class cmGeneratorTarget;
class cmMakefile; class cmMakefile;
class cmListFileBacktrace; class cmListFileBacktrace;
@ -45,11 +46,14 @@ public:
cmGeneratorExpression(cmListFileBacktrace const& backtrace); cmGeneratorExpression(cmListFileBacktrace const& backtrace);
~cmGeneratorExpression(); ~cmGeneratorExpression();
const cmCompiledGeneratorExpression& Parse(std::string const& input); cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(
const cmCompiledGeneratorExpression& Parse(const char* input); std::string const& input);
cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(const char* input);
enum PreprocessContext { enum PreprocessContext {
StripAllGeneratorExpressions StripAllGeneratorExpressions,
BuildInterface,
InstallInterface
}; };
static std::string Preprocess(const std::string &input, static std::string Preprocess(const std::string &input,
@ -60,7 +64,6 @@ private:
void operator=(const cmGeneratorExpression &); void operator=(const cmGeneratorExpression &);
cmListFileBacktrace const& Backtrace; cmListFileBacktrace const& Backtrace;
cmCompiledGeneratorExpression *CompiledExpression;
}; };
class cmCompiledGeneratorExpression class cmCompiledGeneratorExpression
@ -68,31 +71,49 @@ class cmCompiledGeneratorExpression
public: public:
const char* Evaluate(cmMakefile* mf, const char* config, const char* Evaluate(cmMakefile* mf, const char* config,
bool quiet = false, bool quiet = false,
cmGeneratorTarget *target = 0, cmTarget *headTarget = 0,
cmTarget *currentTarget = 0,
cmGeneratorExpressionDAGChecker *dagChecker = 0) const; cmGeneratorExpressionDAGChecker *dagChecker = 0) const;
const char* Evaluate(cmMakefile* mf, const char* config,
bool quiet,
cmTarget *headTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const;
/** Get set of targets found during evaluations. */ /** Get set of targets found during evaluations. */
std::set<cmTarget*> const& GetTargets() const std::set<cmTarget*> const& GetTargets() const
{ return this->Targets; } { return this->Targets; }
std::map<cmStdString, cmStdString> const& GetSeenTargetProperties() const
{ return this->SeenTargetProperties; }
~cmCompiledGeneratorExpression(); ~cmCompiledGeneratorExpression();
std::string GetInput() const
{
return this->Input;
}
cmListFileBacktrace GetBacktrace() const
{
return this->Backtrace;
}
private: private:
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, const char *input);
const char *input, bool needsParsing);
friend class cmGeneratorExpression; friend class cmGeneratorExpression;
cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &); cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &);
void operator=(const cmCompiledGeneratorExpression &); void operator=(const cmCompiledGeneratorExpression &);
cmListFileBacktrace const& Backtrace; cmListFileBacktrace Backtrace;
const std::vector<cmGeneratorExpressionEvaluator*> Evaluators; std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
const char* const Input; const std::string Input;
const bool NeedsParsing; bool NeedsParsing;
mutable std::set<cmTarget*> Targets; mutable std::set<cmTarget*> Targets;
mutable std::map<cmStdString, cmStdString> SeenTargetProperties;
mutable std::string Output; mutable std::string Output;
}; };

View File

@ -24,13 +24,14 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
: Parent(parent), Target(target), Property(property), : Parent(parent), Target(target), Property(property),
Content(content), Backtrace(backtrace) Content(content), Backtrace(backtrace)
{ {
this->IsDAG = this->isDAG(); this->CheckResult = this->checkGraph();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorExpressionDAGChecker::check() const cmGeneratorExpressionDAGChecker::Result
cmGeneratorExpressionDAGChecker::check() const
{ {
return this->IsDAG; return this->CheckResult;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -38,7 +39,7 @@ void cmGeneratorExpressionDAGChecker::reportError(
cmGeneratorExpressionContext *context, cmGeneratorExpressionContext *context,
const std::string &expr) const std::string &expr)
{ {
if (this->IsDAG) if (this->CheckResult == DAG)
{ {
return; return;
} }
@ -57,7 +58,7 @@ void cmGeneratorExpressionDAGChecker::reportError(
e << "Error evaluating generator expression:\n" e << "Error evaluating generator expression:\n"
<< " " << expr << "\n" << " " << expr << "\n"
<< "Self reference on target \"" << "Self reference on target \""
<< context->Target->GetName() << "\".\n"; << context->HeadTarget->GetName() << "\".\n";
context->Makefile->GetCMakeInstance() context->Makefile->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(),
parent->Backtrace); parent->Backtrace);
@ -91,16 +92,17 @@ void cmGeneratorExpressionDAGChecker::reportError(
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorExpressionDAGChecker::isDAG() const cmGeneratorExpressionDAGChecker::Result
cmGeneratorExpressionDAGChecker::checkGraph() const
{ {
const cmGeneratorExpressionDAGChecker *parent = this->Parent; const cmGeneratorExpressionDAGChecker *parent = this->Parent;
while (parent) while (parent)
{ {
if (this->Target == parent->Target && this->Property == parent->Property) if (this->Target == parent->Target && this->Property == parent->Property)
{ {
return false; return parent->Parent ? CYCLIC_REFERENCE : SELF_REFERENCE;
} }
parent = parent->Parent; parent = parent->Parent;
} }
return true; return DAG;
} }

View File

@ -25,12 +25,18 @@ struct cmGeneratorExpressionDAGChecker
const GeneratorExpressionContent *content, const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent); cmGeneratorExpressionDAGChecker *parent);
bool check() const; enum Result {
DAG,
SELF_REFERENCE,
CYCLIC_REFERENCE
};
Result check() const;
void reportError(cmGeneratorExpressionContext *context, void reportError(cmGeneratorExpressionContext *context,
const std::string &expr); const std::string &expr);
private: private:
bool isDAG() const; Result checkGraph() const;
private: private:
const cmGeneratorExpressionDAGChecker * const Parent; const cmGeneratorExpressionDAGChecker * const Parent;
@ -38,7 +44,7 @@ private:
const std::string Property; const std::string Property;
const GeneratorExpressionContent * const Content; const GeneratorExpressionContent * const Content;
const cmListFileBacktrace Backtrace; const cmListFileBacktrace Backtrace;
bool IsDAG; Result CheckResult;
}; };
#endif #endif

View File

@ -18,6 +18,8 @@
#include <cmsys/String.h> #include <cmsys/String.h>
#include <assert.h>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510 #if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
static static
@ -47,6 +49,8 @@ struct cmGeneratorExpressionNode
virtual bool GeneratesContent() const { return true; } virtual bool GeneratesContent() const { return true; }
virtual bool RequiresLiteralInput() const { return false; }
virtual bool AcceptsSingleArbitraryContentParameter() const virtual bool AcceptsSingleArbitraryContentParameter() const
{ return false; } { return false; }
@ -66,6 +70,8 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
virtual bool GeneratesContent() const { return false; } virtual bool GeneratesContent() const { return false; }
virtual bool AcceptsSingleArbitraryContentParameter() const { return true; }
std::string Evaluate(const std::vector<std::string> &, std::string Evaluate(const std::vector<std::string> &,
cmGeneratorExpressionContext *, cmGeneratorExpressionContext *,
const GeneratorExpressionContent *, const GeneratorExpressionContent *,
@ -93,6 +99,12 @@ static const struct OneNode : public cmGeneratorExpressionNode
} }
} oneNode; } oneNode;
//----------------------------------------------------------------------------
static const struct OneNode buildInterfaceNode;
//----------------------------------------------------------------------------
static const struct ZeroNode installInterfaceNode;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ #define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \
static const struct OP ## Node : public cmGeneratorExpressionNode \ static const struct OP ## Node : public cmGeneratorExpressionNode \
@ -255,11 +267,34 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
return parameters.front().empty() ? "1" : "0"; return parameters.front().empty() ? "1" : "0";
} }
return cmsysString_strcasecmp(parameters.begin()->c_str(), if (cmsysString_strcasecmp(parameters.begin()->c_str(),
context->Config) == 0 ? "1" : "0"; context->Config) == 0)
{
return "1";
}
if (context->CurrentTarget
&& context->CurrentTarget->IsImported())
{
const char* loc = 0;
const char* imp = 0;
std::string suffix;
return context->CurrentTarget->GetMappedConfig(context->Config,
&loc,
&imp,
suffix) ? "1" : "0";
}
return "0";
} }
} configurationTestNode; } configurationTestNode;
//----------------------------------------------------------------------------
static const char* targetPropertyTransitiveWhitelist[] = {
"INTERFACE_INCLUDE_DIRECTORIES"
, "INTERFACE_COMPILE_DEFINITIONS"
};
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const struct TargetPropertyNode : public cmGeneratorExpressionNode static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{ {
@ -287,8 +322,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmsys::RegularExpression propertyNameValidator; cmsys::RegularExpression propertyNameValidator;
propertyNameValidator.compile("^[A-Za-z0-9_]+$"); propertyNameValidator.compile("^[A-Za-z0-9_]+$");
cmGeneratorTarget* target = context->Target; cmTarget* target = context->HeadTarget;
std::string propertyName = *parameters.begin(); std::string propertyName = *parameters.begin();
if (!target && parameters.size() == 1)
{
reportError(context, content->GetOriginalExpression(),
"$<TARGET_PROPERTY:prop> may only be used with targets. It may not "
"be used with add_custom_command. Specify the target to read a "
"property from using the $<TARGET_PROPERTY:tgt,prop> signature "
"instead.");
return std::string();
}
if (parameters.size() == 2) if (parameters.size() == 2)
{ {
if (parameters.begin()->empty() && parameters[1].empty()) if (parameters.begin()->empty() && parameters[1].empty())
@ -320,7 +366,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"Target name not supported."); "Target name not supported.");
return std::string(); return std::string();
} }
target = context->Makefile->FindGeneratorTargetToUse( target = context->Makefile->FindTargetToUse(
targetName.c_str()); targetName.c_str());
if (!target) if (!target)
@ -334,6 +380,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
} }
} }
if (target == context->HeadTarget)
{
// Keep track of the properties seen while processing.
// The evaluation of the LINK_LIBRARIES generator expressions
// will check this to ensure that properties form a DAG.
context->SeenTargetProperties.insert(propertyName);
}
if (propertyName.empty()) if (propertyName.empty())
{ {
reportError(context, content->GetOriginalExpression(), reportError(context, content->GetOriginalExpression(),
@ -349,23 +403,74 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string(); return std::string();
} }
assert(target);
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
target->GetName(), target->GetName(),
propertyName, propertyName,
content, content,
dagCheckerParent); dagCheckerParent);
if (!dagChecker.check()) switch (dagChecker.check())
{ {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
dagChecker.reportError(context, content->GetOriginalExpression()); dagChecker.reportError(context, content->GetOriginalExpression());
return std::string(); return std::string();
case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
// No error. We just skip cyclic references.
return std::string();
case cmGeneratorExpressionDAGChecker::DAG:
break;
} }
const char *prop = target->GetProperty(propertyName.c_str()); const char *prop = target->GetProperty(propertyName.c_str());
return prop ? prop : ""; if (!prop)
{
return std::string();
}
for (size_t i = 0;
i < (sizeof(targetPropertyTransitiveWhitelist) /
sizeof(*targetPropertyTransitiveWhitelist));
++i)
{
if (targetPropertyTransitiveWhitelist[i] == propertyName)
{
cmGeneratorExpression ge(context->Backtrace);
return ge.Parse(prop)->Evaluate(context->Makefile,
context->Config,
context->Quiet,
context->HeadTarget,
target,
&dagChecker);
}
}
return prop;
} }
} targetPropertyNode; } targetPropertyNode;
//----------------------------------------------------------------------------
static const struct TargetNameNode : public cmGeneratorExpressionNode
{
TargetNameNode() {}
virtual bool GeneratesContent() const { return true; }
virtual bool AcceptsSingleArbitraryContentParameter() const { return true; }
virtual bool RequiresLiteralInput() const { return true; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
return parameters.front();
}
virtual int NumExpectedParameters() const { return 1; }
} targetNameNode;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template<bool linker, bool soname> template<bool linker, bool soname>
struct TargetFilesystemArtifactResultCreator struct TargetFilesystemArtifactResultCreator
@ -551,13 +656,13 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
{ {
if (identifier == "0") if (identifier == "0")
return &zeroNode; return &zeroNode;
if (identifier == "1") else if (identifier == "1")
return &oneNode; return &oneNode;
if (identifier == "AND") else if (identifier == "AND")
return &andNode; return &andNode;
if (identifier == "OR") else if (identifier == "OR")
return &orNode; return &orNode;
if (identifier == "NOT") else if (identifier == "NOT")
return &notNode; return &notNode;
else if (identifier == "CONFIGURATION") else if (identifier == "CONFIGURATION")
return &configurationNode; return &configurationNode;
@ -591,6 +696,12 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &commaNode; return &commaNode;
else if (identifier == "TARGET_PROPERTY") else if (identifier == "TARGET_PROPERTY")
return &targetPropertyNode; return &targetPropertyNode;
else if (identifier == "TARGET_NAME")
return &targetNameNode;
else if (identifier == "BUILD_INTERFACE")
return &buildInterfaceNode;
else if (identifier == "INSTALL_INTERFACE")
return &installInterfaceNode;
return 0; return 0;
} }
@ -642,6 +753,20 @@ std::string GeneratorExpressionContent::Evaluate(
if (!node->GeneratesContent()) if (!node->GeneratesContent())
{ {
if (node->AcceptsSingleArbitraryContentParameter())
{
if (this->ParamChildren.empty())
{
reportError(context, this->GetOriginalExpression(),
"$<" + identifier + "> expression requires a parameter.");
}
}
else
{
std::vector<std::string> parameters;
this->EvaluateParameters(node, identifier, context, dagChecker,
parameters);
}
return std::string(); return std::string();
} }
@ -666,6 +791,15 @@ std::string GeneratorExpressionContent::Evaluate(
= pit->end(); = pit->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if (node->RequiresLiteralInput())
{
if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text)
{
reportError(context, this->GetOriginalExpression(),
"$<" + identifier + "> expression requires literal input.");
return std::string();
}
}
result += (*it)->Evaluate(context, dagChecker); result += (*it)->Evaluate(context, dagChecker);
if (context->HadError) if (context->HadError)
{ {
@ -673,10 +807,33 @@ std::string GeneratorExpressionContent::Evaluate(
} }
} }
} }
if (node->RequiresLiteralInput())
{
std::vector<std::string> parameters;
parameters.push_back(result);
return node->Evaluate(parameters, context, this, dagChecker);
}
return result; return result;
} }
std::vector<std::string> parameters; std::vector<std::string> parameters;
this->EvaluateParameters(node, identifier, context, dagChecker, parameters);
if (context->HadError)
{
return std::string();
}
return node->Evaluate(parameters, context, this, dagChecker);
}
//----------------------------------------------------------------------------
std::string GeneratorExpressionContent::EvaluateParameters(
const cmGeneratorExpressionNode *node,
const std::string &identifier,
cmGeneratorExpressionContext *context,
cmGeneratorExpressionDAGChecker *dagChecker,
std::vector<std::string> &parameters) const
{
{ {
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
pit = this->ParamChildren.begin(); pit = this->ParamChildren.begin();
@ -732,10 +889,8 @@ std::string GeneratorExpressionContent::Evaluate(
{ {
reportError(context, this->GetOriginalExpression(), "$<" + identifier reportError(context, this->GetOriginalExpression(), "$<" + identifier
+ "> expression requires at least one parameter."); + "> expression requires at least one parameter.");
return std::string();
} }
return std::string();
return node->Evaluate(parameters, context, this, dagChecker);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -18,21 +18,24 @@
#include "cmListFileCache.h" #include "cmListFileCache.h"
class cmTarget; class cmTarget;
class cmGeneratorTarget;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct cmGeneratorExpressionContext struct cmGeneratorExpressionContext
{ {
cmListFileBacktrace Backtrace; cmListFileBacktrace Backtrace;
std::set<cmTarget*> Targets; std::set<cmTarget*> Targets;
std::set<cmStdString> SeenTargetProperties;
cmMakefile *Makefile; cmMakefile *Makefile;
const char *Config; const char *Config;
cmGeneratorTarget *Target; cmTarget *HeadTarget; // The target whose property is being evaluated.
cmTarget *CurrentTarget; // The dependent of HeadTarget which appears
// directly or indirectly in the property.
bool Quiet; bool Quiet;
bool HadError; bool HadError;
}; };
struct cmGeneratorExpressionDAGChecker; struct cmGeneratorExpressionDAGChecker;
struct cmGeneratorExpressionNode;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct cmGeneratorExpressionEvaluator struct cmGeneratorExpressionEvaluator
@ -117,6 +120,13 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
~GeneratorExpressionContent(); ~GeneratorExpressionContent();
private:
std::string EvaluateParameters(const cmGeneratorExpressionNode *node,
const std::string &identifier,
cmGeneratorExpressionContext *context,
cmGeneratorExpressionDAGChecker *dagChecker,
std::vector<std::string> &parameters) const;
private: private:
std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren; std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren; std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;

View File

@ -88,7 +88,15 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression
&& this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator) && this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator)
{ {
this->ParseContent(identifier); if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
{
extendText(identifier, this->it);
++this->it;
}
else
{
this->ParseContent(identifier);
}
if (this->it == this->Tokens.end()) if (this->it == this->Tokens.end())
{ {
break; break;

View File

@ -14,14 +14,11 @@
#include "cmTarget.h" #include "cmTarget.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmComputeLinkInformation.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmGeneratorExpression.h" #include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpressionDAGChecker.h"
#include <assert.h>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
{ {
@ -32,15 +29,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
this->LookupObjectLibraries(); this->LookupObjectLibraries();
} }
cmGeneratorTarget::~cmGeneratorTarget()
{
for(std::map<cmStdString, cmComputeLinkInformation*>::iterator i
= LinkInformation.begin(); i != LinkInformation.end(); ++i)
{
delete i->second;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int cmGeneratorTarget::GetType() const int cmGeneratorTarget::GetType() const
{ {
@ -220,32 +208,6 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs)
} }
} }
//----------------------------------------------------------------------------
cmComputeLinkInformation*
cmGeneratorTarget::GetLinkInformation(const char* config)
{
// Lookup any existing information for this configuration.
std::map<cmStdString, cmComputeLinkInformation*>::iterator
i = this->LinkInformation.find(config?config:"");
if(i == this->LinkInformation.end())
{
// Compute information for this configuration.
cmComputeLinkInformation* info =
new cmComputeLinkInformation(this->Target, config);
if(!info || !info->Compute())
{
delete info;
info = 0;
}
// Store the information for this configuration.
std::map<cmStdString, cmComputeLinkInformation*>::value_type
entry(config?config:"", info);
i = this->LinkInformation.insert(entry).first;
}
return i->second;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGeneratorTarget::GetAppleArchs(const char* config, void cmGeneratorTarget::GetAppleArchs(const char* config,
std::vector<std::string>& archVec) std::vector<std::string>& archVec)
@ -290,45 +252,7 @@ const char* cmGeneratorTarget::GetCreateRuleVariable()
std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories( std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
const char *config) const char *config)
{ {
std::vector<std::string> includes; return this->Target->GetIncludeDirectories(config);
const char *prop = this->Target->GetProperty("INCLUDE_DIRECTORIES");
if(!prop)
{
return includes;
}
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
this->GetName(),
"INCLUDE_DIRECTORIES", 0, 0);
cmSystemTools::ExpandListArgument(ge.Parse(prop)
.Evaluate(this->Makefile,
config,
false,
this,
&dagChecker),
includes);
std::set<std::string> uniqueIncludes;
std::vector<std::string> orderedAndUniqueIncludes;
for(std::vector<std::string>::const_iterator
li = includes.begin(); li != includes.end(); ++li)
{
std::string inc = *li;
if (!cmSystemTools::IsOff(inc.c_str()))
{
cmSystemTools::ConvertToUnixSlashes(inc);
}
if(uniqueIncludes.insert(inc).second)
{
orderedAndUniqueIncludes.push_back(inc);
}
}
return orderedAndUniqueIncludes;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -353,9 +277,9 @@ std::string cmGeneratorTarget::GetCompileDefinitions(const char *config)
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(lfbt,
this->GetName(), this->GetName(),
defPropName, 0, 0); defPropName, 0, 0);
return ge.Parse(prop).Evaluate(this->Makefile, return ge.Parse(prop)->Evaluate(this->Makefile,
config, config,
false, false,
this, this->Target,
&dagChecker); &dagChecker);
} }

View File

@ -14,7 +14,6 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmComputeLinkInformation;
class cmCustomCommand; class cmCustomCommand;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmLocalGenerator; class cmLocalGenerator;
@ -26,7 +25,6 @@ class cmGeneratorTarget
{ {
public: public:
cmGeneratorTarget(cmTarget*); cmGeneratorTarget(cmTarget*);
~cmGeneratorTarget();
int GetType() const; int GetType() const;
const char *GetName() const; const char *GetName() const;
@ -60,10 +58,6 @@ public:
void UseObjectLibraries(std::vector<std::string>& objs); void UseObjectLibraries(std::vector<std::string>& objs);
std::map<cmStdString, cmComputeLinkInformation*> LinkInformation;
cmComputeLinkInformation* GetLinkInformation(const char* config);
void GetAppleArchs(const char* config, void GetAppleArchs(const char* config,
std::vector<std::string>& archVec); std::vector<std::string>& archVec);

View File

@ -938,6 +938,23 @@ void cmGlobalGenerator::Generate()
(*targets)[tit->first] = tit->second; (*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf); (*targets)[tit->first].SetMakefile(mf);
} }
for ( tit = targets->begin(); tit != targets->end(); ++ tit )
{
if (mf->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES"))
{
const char *binDir = mf->GetStartOutputDirectory();
const char *srcDir = mf->GetStartDirectory();
const std::string dirs = std::string(binDir ? binDir : "")
+ std::string(binDir ? ";" : "")
+ std::string(srcDir ? srcDir : "");
if (!dirs.empty())
{
tit->second.AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
("$<BUILD_INTERFACE:" + dirs + ">").c_str());
}
}
}
} }
// Add generator specific helper commands // Add generator specific helper commands
@ -2047,7 +2064,7 @@ bool cmGlobalGenerator::UseFolderProperty()
} }
// By default, this feature is OFF, since it is not supported in the // By default, this feature is OFF, since it is not supported in the
// Visual Studio Express editions: // Visual Studio Express editions until VS11:
// //
return false; return false;
} }

View File

@ -144,8 +144,7 @@ void cmGlobalVisualStudio10Generator
::EnableLanguage(std::vector<std::string>const & lang, ::EnableLanguage(std::vector<std::string>const & lang,
cmMakefile *mf, bool optional) cmMakefile *mf, bool optional)
{ {
if(!strcmp(this->ArchitectureId, "Itanium") || if(this->ArchitectureId == "Itanium" || this->ArchitectureId == "x64")
!strcmp(this->ArchitectureId, "x64"))
{ {
if(this->IsExpressEdition() && !this->Find64BitTools(mf)) if(this->IsExpressEdition() && !this->Find64BitTools(mf))
{ {

View File

@ -93,3 +93,12 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::UseFolderProperty()
{
// Intentionally skip over the parent class implementation and call the
// grand-parent class's implementation. Folders are not supported by the
// Express editions in VS10 and earlier, but they are in VS11 Express.
return cmGlobalVisualStudio8Generator::UseFolderProperty();
}

Some files were not shown because too many files have changed in this diff Show More