Merge tag 'upstream/2.8.11-rc3'

Upstream version 2.8.11-rc3
ci/unstable
Modestas Vainius 12 years ago
commit 553faecfa4

@ -1,3 +1,80 @@
Changes in CMake 2.8.11-rc3 (since 2.8.11-rc2)
----------------------------------------------
Brad King (1):
get_filename_component: Document path components more clearly (#14091)
Rolf Eike Beer (1):
try_compile: add missing fclose() to recently added error case
Stephen Kelly (1):
Fix clearing of the INCLUDE_DIRECTORIES DIRECTORY property.
Changes in CMake 2.8.11-rc2 (since 2.8.11-rc1)
----------------------------------------------
Alex Neundorf (6):
Determine C/CXX/Fortran compiler: minor restructuring
Determine C/CXX/Fortran compiler: fix indentation
rename TI_DSP toolchain to TI, since it works also for the ARM compiler
TI compiler: add automatic detection of prefix and suffixes
Modules/readme.txt: switch from "XXX" to "Xxx"
Modules/readme.txt: make lines a bit shorter for easier readability
Ben Boeckel (1):
Clang: Add -isystem flag support everywhere
Bill Hoffman (1):
ExternalProject: Retry on a failed git clone
Brad King (8):
string: Fix regex documentation of '^' and '$' (#14028)
Rename variable for including current directory in interfaces
Replace <TARGET> in CMAKE_<LANG>_COMPILE_OBJECT rule variables
Test evaluation of per-config COMPILE_DEFINITIONS (#14037)
VS: Fix VS 10/11 .sln headers (#14038)
add_dependencies: Distinguish target v. file dependencies in error (#14050)
automoc: Use a pre-build event in VS >= 7
Handle usr-move without forcing absolute paths (#14041)
Clinton Stimpson (2):
FindQt4: If Qt5 is in CMAKE_PREFIX_PATH, be sure to find Qt4 includes.
Qt4: Fix typo setting a variable for FindThreads.
James Bigler (1):
FindCUDA: Use the PRE_LINK mode only for MSVC >= 10
Matthew Woehlke (4):
UseJava.cmake: simplify path logic
UseJava.cmake: fix passing jars to add_jar
UseJava.cmake: accept jar targets in add_jar
UseJava.cmake: require explicit request to include jars
Paul Kunysch (1):
CPack: Avoid "format expects 'unsigned int'" warnings
Petr Kmoch (1):
cmSystemTools: Generalize TrimWhitespace to all whitespace
Rex Dieter (1):
FindImageMagick: Search versioned suffixes (#14012)
Rolf Eike Beer (1):
FindRuby: improve version selection
Stephen Kelly (13):
FindQt4: Set the Qt4_FOUND variable if Qt4 is found
FindQt4: Set the INTERFACE_QT_MAJOR_VERSION for Qt4::QtCore
Document that CMAKE_AUTOMOC works with Qt 5.
FPHSA: Fix FOUND_VAR check to work with if() auto-dereference
Fix cmGeneratorExpression::Preprocess for interleaved inputs.
cmake-gui: Use the QStandardItemModel workaround until 5.1.0.
Automoc: append implicit includes after user-specified dirs
Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
Fix new target commands documentation.
install(EXPORT): Ensure clean INTERFACE_INCLUDE_DIRECTORIES
Report an error on IMPORTED targets with a faulty INTERFACE
Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
Fix the Qt 5 version required to run the IncompatibleQt test.
Changes in CMake 2.8.11-rc1 (since 2.8.10.2) Changes in CMake 2.8.11-rc1 (since 2.8.10.2)
---------------------------------------------- ----------------------------------------------
Alan Witkowski (1): Alan Witkowski (1):

@ -109,7 +109,7 @@
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__) #elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI_DSP" # define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */ /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)

@ -114,7 +114,7 @@
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__) #elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI_DSP" # define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */ /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)

@ -99,9 +99,9 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI "-h")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI "Texas Instruments")
include(CMakeDetermineCompilerId) include(CMakeDetermineCompilerId)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})

@ -145,19 +145,27 @@ endif ()
# NAME_WE cannot be used since then this test will fail for names lile # NAME_WE cannot be used since then this test will fail for names lile
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
AND NOT _CMAKE_TOOLCHAIN_PREFIX) if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif () endif ()
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif () endif ()
elseif("${CMAKE_C_COMPILER_ID}" MATCHES "TI")
# TI compilers are named e.g. cl6x, cl470 or armcl.exe
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}")
set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}")
endif ()
endif()
endif () endif ()

@ -141,19 +141,30 @@ endif ()
# NAME_WE cannot be used since then this test will fail for names lile # NAME_WE cannot be used since then this test will fail for names lile
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING
AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
AND NOT _CMAKE_TOOLCHAIN_PREFIX) if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
endif () if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils endif ()
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
endif () if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif ()
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "TI")
# TI compilers are named e.g. cl6x, cl470 or armcl.exe
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}")
set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}")
endif ()
endif()
endif () endif ()

@ -200,19 +200,21 @@ endif ()
# NAME_WE cannot be used since then this test will fail for names lile # NAME_WE cannot be used since then this test will fail for names lile
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU"
AND NOT _CMAKE_TOOLCHAIN_PREFIX) if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME) get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif () endif ()
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif () endif ()
endif()
endif () endif ()
include(CMakeFindBinUtils) include(CMakeFindBinUtils)

@ -41,14 +41,14 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
# in all other cases search for ar, ranlib, etc. # in all other cases search for ar, ranlib, etc.
else() else()
find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
if(NOT CMAKE_RANLIB) if(NOT CMAKE_RANLIB)
set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
endif() endif()
find_program(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION})

@ -9,8 +9,6 @@
# configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake # configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake
# file for installing a project or library. It helps making the resulting package # file for installing a project or library. It helps making the resulting package
# relocatable by avoiding hardcoded paths in the installed Config.cmake file. # relocatable by avoiding hardcoded paths in the installed Config.cmake file.
# <Name>Config.cmake files installed under UNIX into /lib(64) or /usr/lib(64) are
# considered system packages and are not relocatable.
# #
# In a FooConfig.cmake file there may be code like this to make the # In a FooConfig.cmake file there may be code like this to make the
# install destinations know to the using project: # install destinations know to the using project:
@ -176,32 +174,17 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
endif() endif()
# with the /usr-move, /lib(64) is a symlink to /usr/lib on Fedora, ArchLinux, Mageira and others.
# If we are installed to such a location, force using absolute paths.
set(forceAbsolutePaths FALSE)
if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+")
set(forceAbsolutePaths TRUE)
endif()
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
foreach(var ${CCF_PATH_VARS}) foreach(var ${CCF_PATH_VARS})
if(NOT DEFINED ${var}) if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} does not exist") message(FATAL_ERROR "Variable ${var} does not exist")
else() else()
if(forceAbsolutePaths) if(IS_ABSOLUTE "${${var}}")
if(IS_ABSOLUTE "${${var}}") string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
set(PACKAGE_${var} "${${var}}") PACKAGE_${var} "${${var}}")
else()
set(PACKAGE_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else() else()
if(IS_ABSOLUTE "${${var}}") set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
PACKAGE_${var} "${${var}}")
else()
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
endif()
endif() endif()
endif() endif()
endforeach() endforeach()
@ -216,6 +199,21 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
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)
") ")
if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+")
# Handle "/usr move" symlinks created by some Linux distros.
set(PACKAGE_INIT "${PACKAGE_INIT}
# Use original install prefix when loaded through a \"/usr move\"
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
get_filename_component(_realOrig \"${absInstallDir}\" REALPATH)
if(_realCurr STREQUAL _realOrig)
set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\")
endif()
unset(_realOrig)
unset(_realCurr)
")
endif()
if(NOT CCF_NO_SET_AND_CHECK_MACRO) if(NOT CCF_NO_SET_AND_CHECK_MACRO)
set(PACKAGE_INIT "${PACKAGE_INIT} set(PACKAGE_INIT "${PACKAGE_INIT}
macro(set_and_check _var _file) macro(set_and_check _var _file)

@ -23,4 +23,5 @@ include(Compiler/GNU)
macro(__compiler_clang lang) macro(__compiler_clang lang)
__compiler_gnu(${lang}) __compiler_gnu(${lang})
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
endmacro() endmacro()

@ -287,11 +287,21 @@ if(error_code)
message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\")
endif() endif()
execute_process( # try the clone 3 times incase there is an odd git clone issue
COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\" set(error_code 1)
WORKING_DIRECTORY \"${work_dir}\" set(number_of_tries 0)
RESULT_VARIABLE error_code while(error_code AND number_of_tries LESS 3)
) execute_process(
COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\"
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
)
math(EXPR number_of_tries \"\${number_of_tries} + 1\")
endwhile()
if(number_of_tries GREATER 1)
message(STATUS \"Had to git clone more than once:
\${number_of_tries} times.\")
endif()
if(error_code) if(error_code)
message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\") message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\")
endif() endif()

@ -1341,13 +1341,6 @@ endfunction()
function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options object_files) function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options object_files)
if (object_files) if (object_files)
if(NOT EXISTS "${output_file}")
# Some generators (e.g. makefiles) can't proceed to the link phase if all
# input files aren't available. This guarantees the file exists, so that
# linking can begin.
execute_process(COMMAND ${CMAKE_COMMAND} -E touch "${output_file}")
endif()
set_source_files_properties("${output_file}" set_source_files_properties("${output_file}"
PROPERTIES PROPERTIES
EXTERNAL_OBJECT TRUE # This is an object file not to be compiled, but only EXTERNAL_OBJECT TRUE # This is an object file not to be compiled, but only
@ -1379,12 +1372,34 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
endforeach() endforeach()
endforeach() endforeach()
file(RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}") file(RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}")
add_custom_command(
TARGET ${cuda_target} # Some generators don't handle the multiple levels of custom command
PRE_LINK # dependencies correctly (obj1 depends on file1, obj2 depends on obj1), so
COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" # we work around that issue by compiling the intermediate link object as a
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" # pre-link custom command in that situation.
) set(do_obj_build_rule TRUE)
if (MSVC_VERSION GREATER 1599)
# VS 2010 and 2012 have this problem. If future versions fix this issue,
# it should still work, it just won't be as nice as the other method.
set(do_obj_build_rule FALSE)
endif()
if (do_obj_build_rule)
add_custom_command(
OUTPUT ${output_file}
DEPENDS ${object_files}
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file}
${flags}
COMMENT "Building NVCC intermediate link file ${output_file_relative_path}"
)
else()
add_custom_command(
TARGET ${cuda_target}
PRE_LINK
COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}"
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}"
)
endif()
endif() endif()
endfunction() endfunction()

@ -147,17 +147,17 @@ foreach(component ${ImageMagick_FIND_COMPONENTS}
) )
if(component STREQUAL "Magick++") if(component STREQUAL "Magick++")
FIND_IMAGEMAGICK_API(Magick++ Magick++.h FIND_IMAGEMAGICK_API(Magick++ Magick++.h
Magick++ CORE_RL_Magick++_ Magick++-Q16 Magick++-Q8 Magick++ CORE_RL_Magick++_ Magick++-6.Q16 Magick++-Q16 Magick++-6.Q8 Magick++-Q8
) )
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
elseif(component STREQUAL "MagickWand") elseif(component STREQUAL "MagickWand")
FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h
Wand MagickWand CORE_RL_wand_ MagickWand-Q16 MagickWand-Q8 Wand MagickWand CORE_RL_wand_ MagickWand-6.Q16 MagickWand-Q16 MagickWand-6.Q8 MagickWand-Q8
) )
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
elseif(component STREQUAL "MagickCore") elseif(component STREQUAL "MagickCore")
FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h
Magick MagickCore CORE_RL_magick_ MagickCore-Q16 MagickCore-Q8 Magick MagickCore CORE_RL_magick_ MagickCore-6.Q16 MagickCore-Q16 MagickCore-6.Q8 MagickCore-Q8
) )
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
else() else()

@ -195,7 +195,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
string(TOLOWER ${_NAME} _NAME_LOWER) string(TOLOWER ${_NAME} _NAME_LOWER)
if(FPHSA_FOUND_VAR) if(FPHSA_FOUND_VAR)
if("${FPHSA_FOUND_VAR}" MATCHES "^${_NAME}_FOUND$" OR "${FPHSA_FOUND_VAR}" MATCHES "^${_NAME_UPPER}_FOUND$") if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
set(_FOUND_VAR ${FPHSA_FOUND_VAR}) set(_FOUND_VAR ${FPHSA_FOUND_VAR})
else() else()
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")

@ -187,7 +187,8 @@
# #
# Below is a detailed list of variables that FindQt4.cmake sets. # Below is a detailed list of variables that FindQt4.cmake sets.
# QT_FOUND If false, don't try to use Qt. # QT_FOUND If false, don't try to use Qt.
# QT4_FOUND If false, don't try to use Qt 4. # Qt4_FOUND If false, don't try to use Qt 4.
# QT4_FOUND If false, don't try to use Qt 4. This variable is for compatibility only.
# #
# QT_VERSION_MAJOR The major version of Qt found. # QT_VERSION_MAJOR The major version of Qt found.
# QT_VERSION_MINOR The minor version of Qt found. # QT_VERSION_MINOR The minor version of Qt found.
@ -685,7 +686,14 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
find_path(QT_QTCORE_INCLUDE_DIR QtCore find_path(QT_QTCORE_INCLUDE_DIR QtCore
HINTS ${qt_headers} ${QT_LIBRARY_DIR} HINTS ${qt_headers} ${QT_LIBRARY_DIR}
PATH_SUFFIXES QtCore qt4/QtCore PATH_SUFFIXES QtCore qt4/QtCore
NO_DEFAULT_PATH
) )
if(NOT QT_QTCORE_INCLUDE_DIR)
find_path(QT_QTCORE_INCLUDE_DIR QtCore
HINTS ${qt_headers} ${QT_LIBRARY_DIR}
PATH_SUFFIXES QtCore qt4/QtCore
)
endif()
# Set QT_HEADERS_DIR based on finding QtCore header # Set QT_HEADERS_DIR based on finding QtCore header
if(QT_QTCORE_INCLUDE_DIR) if(QT_QTCORE_INCLUDE_DIR)
@ -1022,6 +1030,12 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
"${QT_MKSPECS_DIR}/default" "${QT_MKSPECS_DIR}/default"
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}
) )
set_property(TARGET Qt4::QtCore PROPERTY
INTERFACE_QT_MAJOR_VERSION 4
)
set_property(TARGET Qt4::QtCore APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION
)
foreach(QT_MODULE ${QT_MODULES}) foreach(QT_MODULE ${QT_MODULES})
_QT4_ADJUST_LIB_VARS(${QT_MODULE}) _QT4_ADJUST_LIB_VARS(${QT_MODULE})
@ -1358,7 +1372,7 @@ if (NOT QT_VERSION_MAJOR EQUAL 4)
endif() endif()
endif() endif()
else() else()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 FOUND_VAR Qt4_FOUND
REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
VERSION_VAR QTVERSION VERSION_VAR QTVERSION
) )
@ -1373,5 +1387,6 @@ endif()
set (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) set (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
set (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) set (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
set( QT_QT_LIBRARY "") set( QT_QT_LIBRARY "")
set(QT_FOUND ${QT4_FOUND}) set(QT4_FOUND ${Qt4_FOUND})
set(QT_FOUND ${Qt4_FOUND})

@ -46,15 +46,24 @@ set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby)
# if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8 # if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8
if(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR) if(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR)
set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}") set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}")
# we can't construct that if only major version is given
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES
ruby${Ruby_FIND_VERSION_MAJOR}.${Ruby_FIND_VERSION_MINOR}
ruby${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR}
${_RUBY_POSSIBLE_EXECUTABLE_NAMES})
else() else()
set(Ruby_FIND_VERSION_SHORT_NODOT "18") set(Ruby_FIND_VERSION_SHORT_NODOT "18")
endif() endif()
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.9 ruby19) if(NOT Ruby_FIND_VERSION_EXACT)
list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19)
# if we want a version below 1.9, also look for ruby 1.8 # if we want a version below 1.9, also look for ruby 1.8
if("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19") if("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19")
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.8 ruby18) list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.8 ruby18)
endif()
list(REMOVE_DUPLICATES _RUBY_POSSIBLE_EXECUTABLE_NAMES)
endif() endif()
find_program(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) find_program(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES})

@ -260,7 +260,7 @@ if(Q_WS_X11)
# X11 libraries Qt always depends on # X11 libraries Qt always depends on
set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB})
set(CMAKE_THREAD_PREFER_PTHREADS 1) set(CMAKE_THREAD_PREFER_PTHREAD 1)
find_package(Threads) find_package(Threads)
if(CMAKE_USE_PTHREADS_INIT) if(CMAKE_USE_PTHREADS_INIT)
set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})

@ -3,11 +3,19 @@
# has already been loaded. See FindJava.cmake for information on how to # has already been loaded. See FindJava.cmake for information on how to
# load Java into your CMake project. # load Java into your CMake project.
# #
# add_jar(TARGET_NAME SRC1 SRC2 .. SRCN RCS1 RCS2 .. RCSN) # add_jar(target_name
# # [SOURCES] source1 [source2 ...] [resource1 ...]
# This command creates a <TARGET_NAME>.jar. It compiles the given source # [INCLUDE_JARS jar1 [jar2 ...]]
# files (SRC) and adds the given resource files (RCS) to the jar file. # )
# If only resource files are given then just a jar file is created. #
# This command creates a <target_name>.jar. It compiles the given source files
# (source) and adds the given resource files (resource) to the jar file. If
# only resource files are given then just a jar file is created. The list of
# include jars are added to the classpath when compiling the java sources and
# also to the dependencies of the target. INCLUDE_JARS also accepts other
# target names created by add_jar. For backwards compatibility, jar files
# listed as sources are ignored (as they have been since the first version of
# this module).
# #
# Additional instructions: # Additional instructions:
# To add compile flags to the target you can set these flags with # To add compile flags to the target you can set these flags with
@ -190,6 +198,8 @@
# (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.)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
function (__java_copy_file src dest comment) function (__java_copy_file src dest comment)
add_custom_command( add_custom_command(
OUTPUT ${dest} OUTPUT ${dest}
@ -205,7 +215,10 @@ set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.c
set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
function(add_jar _TARGET_NAME) function(add_jar _TARGET_NAME)
set(_JAVA_SOURCE_FILES ${ARGN})
cmake_parse_arguments(_add_jar "" "" "SOURCES;INCLUDE_JARS" ${ARGN})
set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS})
if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
@ -257,6 +270,7 @@ function(add_jar _TARGET_NAME)
set(_JAVA_CLASS_FILES) set(_JAVA_CLASS_FILES)
set(_JAVA_COMPILE_FILES) set(_JAVA_COMPILE_FILES)
set(_JAVA_DEPENDS) set(_JAVA_DEPENDS)
set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES) set(_JAVA_RESOURCE_FILES)
foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
@ -264,18 +278,18 @@ function(add_jar _TARGET_NAME)
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
if (${_BIN_LEN} LESS ${_SRC_LEN})
set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
else ()
set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
endif ()
get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH)
if (_JAVA_EXT MATCHES ".java") if (_JAVA_EXT MATCHES ".java")
file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
if (${_BIN_LEN} LESS ${_SRC_LEN})
set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
else ()
set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
endif ()
get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH)
list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE})
set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class") set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class")
set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE}) set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE})
@ -284,7 +298,7 @@ function(add_jar _TARGET_NAME)
OR _JAVA_EXT MATCHES ".war" OR _JAVA_EXT MATCHES ".war"
OR _JAVA_EXT MATCHES ".ear" OR _JAVA_EXT MATCHES ".ear"
OR _JAVA_EXT MATCHES ".sar") OR _JAVA_EXT MATCHES ".sar")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_SOURCE_FILE}) # Ignored for backward compatibility
elseif (_JAVA_EXT STREQUAL "") elseif (_JAVA_EXT STREQUAL "")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH})
@ -298,6 +312,25 @@ function(add_jar _TARGET_NAME)
endif () endif ()
endforeach() endforeach()
foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS})
if (TARGET ${_JAVA_INCLUDE_JAR})
get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
if (_JAVA_JAR_PATH)
set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR})
else ()
message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar")
endif ()
else ()
set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}")
list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}")
list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}")
endif ()
endforeach()
# create an empty java_class_filelist # create an empty java_class_filelist
if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist)
file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
@ -314,7 +347,7 @@ function(add_jar _TARGET_NAME)
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILES}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
DEPENDS ${_JAVA_COMPILE_FILES} DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_DEPENDS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Building Java objects for ${_TARGET_NAME}.jar" COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
) )

@ -1,50 +1,65 @@
For more information about how to contribute modules to CMake, see this page: For more information about how to contribute modules to CMake, see this page:
http://www.itk.org/Wiki/CMake:Module_Maintainers http://www.itk.org/Wiki/CMake:Module_Maintainers
Note to authors of FindXXX.cmake files Note to authors of FindXxx.cmake files
We would like all FindXXX.cmake files to produce consistent variable names. We would like all FindXxx.cmake files to produce consistent variable names.
Please use the following consistent variable names for general use. Please use the following consistent variable names for general use.
XXX_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code. This should not be a cache entry. Xxx_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code.
XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry. This should not be a cache entry.
XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include <jpeg.h> Xxx_LIBRARIES The libraries to link against to use Xxx. These should include full paths.
XXX_EXECUTABLE Where to find the XXX tool. This should not be a cache entry.
XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX. Xxx_DEFINITIONS Definitions to use when compiling code that uses Xxx. This really shouldn't include options such
XXX_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code. This should not be a cache entry. as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include <jpeg.h>
XXX_ROOT_DIR Where to find the base directory of XXX. Xxx_EXECUTABLE Where to find the Xxx tool.
XXX_VERSION_YY Expect Version YY if true. Make sure at most one of these is ever true. Xxx_Yyy_EXECUTABLE Where to find the Yyy tool that comes with Xxx.
XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command. Xxx_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code.
XXX_YY_FOUND If False, optional YY part of XXX sytem is not available. This should not be a cache entry.
XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX. Xxx_ROOT_DIR Where to find the base directory of Xxx.
XXX_NOT_FOUND_MESSAGE Should be set by config-files in the case that it has set XXX_FOUND to FALSE. Xxx_VERSION_Yy Expect Version Yy if true. Make sure at most one of these is ever true.
Xxx_WRAP_Yy If False, do not try to use the relevant CMake wrapping command.
Xxx_Yy_FOUND If False, optional Yy part of Xxx sytem is not available.
Xxx_FOUND Set to false, or undefined, if we haven't found, or don't want to use Xxx.
Xxx_NOT_FOUND_MESSAGE Should be set by config-files in the case that it has set Xxx_FOUND to FALSE.
The contained message will be printed by the find_package() command and by The contained message will be printed by the find_package() command and by
find_package_handle_standard_args() to inform the user about the problem. find_package_handle_standard_args() to inform the user about the problem.
XXX_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to shared libraries. Xxx_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to
shared libraries.
The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix. The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix.
This should not be a cache entry. This should not be a cache entry.
XXX_VERSION_STRING A human-readable string containing the version of the package found, if any. Xxx_VERSION_STRING A human-readable string containing the version of the package found, if any.
XXX_VERSION_MAJOR The major version of the package found, if any. Xxx_VERSION_MAJOR The major version of the package found, if any.
XXX_VERSION_MINOR The minor version of the package found, if any. Xxx_VERSION_MINOR The minor version of the package found, if any.
XXX_VERSION_PATCH The patch version of the package found, if any. Xxx_VERSION_PATCH The patch version of the package found, if any.
You do not have to provide all of the above variables. You should provide XXX_FOUND under most circumstances. If XXX is a library, then XXX_LIBRARIES, should also be defined, and XXX_INCLUDE_DIRS should usually be defined (I guess libm.a might be an exception) You do not have to provide all of the above variables. You should provide Xxx_FOUND under most circumstances.
If Xxx is a library, then Xxx_LIBRARIES, should also be defined, and Xxx_INCLUDE_DIRS should usually be
defined (I guess libm.a might be an exception)
The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in users' CMake Caches to control stuff. The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in
users' CMake Caches to control stuff.
XXX_LIBRARY Name of XXX Library. A User may set this and XXX_INCLUDE_DIR to ignore to force non-use of XXX. Xxx_LIBRARY Name of Xxx Library. A User may set this and Xxx_INCLUDE_DIR to ignore to force non-use of Xxx.
XXX_YY_LIBRARY Name of YY library that is part of the XXX system. It may or may not be required to use XXX. Xxx_Yy_LIBRARY Name of Yy library that is part of the Xxx system. It may or may not be required to use Xxx.
XXX_INCLUDE_DIR Where to find xxx.h, etc. (XXX_INCLUDE_PATH was considered bad because a path includes an actual filename.) Xxx_INCLUDE_DIR Where to find xxx.h, etc. (Xxx_INCLUDE_PATH was considered bad because a path includes an
XXX_YY_INCLUDE_DIR Where to find xxx_yy.h, etc. actual filename.)
Xxx_Yy_INCLUDE_DIR Where to find xxx_yy.h, etc.
For tidiness's sake, try to keep as many options as possible out of the cache, leaving at least one option which can be used to disable use of the module, or locate a not-found library (e.g. XXX_ROOT_DIR). For the same reason, mark most cache options as advanced. For tidiness's sake, try to keep as many options as possible out of the cache, leaving at least one option which can be
used to disable use of the module, or locate a not-found library (e.g. Xxx_ROOT_DIR).
For the same reason, mark most cache options as advanced.
If you need other commands to do special things then it should still begin with XXX_. This gives a sort of namespace effect and keeps things tidy for the user. You should put comments describing all the exported settings, plus descriptions of any the users can use to control stuff. If you need other commands to do special things then it should still begin with Xxx_. This gives a sort of namespace
effect and keeps things tidy for the user. You should put comments describing all the exported settings, plus
descriptions of any the users can use to control stuff.
You really should also provide backwards compatibility any old settings that were actually in use. Make sure you comment them as deprecated, so that no-one starts using them. You really should also provide backwards compatibility any old settings that were actually in use.
Make sure you comment them as deprecated, so that no-one starts using them.
To correctly document a module, create a comment block at the top with # comments. There are three types of comments that can be in the block: To correctly document a module, create a comment block at the top with # comments.
There are three types of comments that can be in the block:
1. The brief description of the module, this is done by: 1. The brief description of the module, this is done by:
# - a small description # - a small description
@ -67,7 +82,7 @@ For example:
# VAR_REALLY_COOL - cool right? # VAR_REALLY_COOL - cool right?
# #
Test the documentation formatting by running "cmake --help-module FindXXX". Test the documentation formatting by running "cmake --help-module FindXxx".
Edit the comments until the output of this command looks satisfactory. Edit the comments until the output of this command looks satisfactory.
To have a .cmake file in this directory NOT show up in the To have a .cmake file in this directory NOT show up in the
@ -93,38 +108,38 @@ copyright and licence notice block like this one:
The layout of the notice block is strictly enforced by the ModuleNotices test. The layout of the notice block is strictly enforced by the ModuleNotices test.
Only the year range and name may be changed freely. Only the year range and name may be changed freely.
A FindXXX.cmake module will typically be loaded by the command A FindXxx.cmake module will typically be loaded by the command
FIND_PACKAGE(XXX [major[.minor[.patch[.tweak]]]] [EXACT] FIND_PACKAGE(Xxx [major[.minor[.patch[.tweak]]]] [EXACT]
[QUIET] [[REQUIRED|COMPONENTS] [components...]]) [QUIET] [[REQUIRED|COMPONENTS] [components...]])
If any version numbers are given to the command it will set the If any version numbers are given to the command it will set the
following variables before loading the module: following variables before loading the module:
XXX_FIND_VERSION = full requested version string Xxx_FIND_VERSION = full requested version string
XXX_FIND_VERSION_MAJOR = major version if requested, else 0 Xxx_FIND_VERSION_MAJOR = major version if requested, else 0
XXX_FIND_VERSION_MINOR = minor version if requested, else 0 Xxx_FIND_VERSION_MINOR = minor version if requested, else 0
XXX_FIND_VERSION_PATCH = patch version if requested, else 0 Xxx_FIND_VERSION_PATCH = patch version if requested, else 0
XXX_FIND_VERSION_TWEAK = tweak version if requested, else 0 Xxx_FIND_VERSION_TWEAK = tweak version if requested, else 0
XXX_FIND_VERSION_COUNT = number of version components, 0 to 4 Xxx_FIND_VERSION_COUNT = number of version components, 0 to 4
XXX_FIND_VERSION_EXACT = true if EXACT option was given Xxx_FIND_VERSION_EXACT = true if EXACT option was given
If the find module supports versioning it should locate a version of If the find module supports versioning it should locate a version of
the package that is compatible with the version requested. If a the package that is compatible with the version requested. If a
compatible version of the package cannot be found the module should compatible version of the package cannot be found the module should
not report success. The version of the package found should be stored not report success. The version of the package found should be stored
in "XXX_VERSION..." version variables documented by the module. in "Xxx_VERSION..." version variables documented by the module.
If the QUIET option is given to the command it will set the variable If the QUIET option is given to the command it will set the variable
XXX_FIND_QUIETLY to true before loading the FindXXX.cmake module. If Xxx_FIND_QUIETLY to true before loading the FindXxx.cmake module. If
this variable is set the module should not complain about not being this variable is set the module should not complain about not being
able to find the package. If the able to find the package. If the
REQUIRED option is given to the command it will set the variable REQUIRED option is given to the command it will set the variable
XXX_FIND_REQUIRED to true before loading the FindXXX.cmake module. If Xxx_FIND_REQUIRED to true before loading the FindXxx.cmake module. If
this variable is set the module should issue a FATAL_ERROR if the this variable is set the module should issue a FATAL_ERROR if the
package cannot be found. package cannot be found.
If neither the QUIET nor REQUIRED options are given then the If neither the QUIET nor REQUIRED options are given then the
FindXXX.cmake module should look for the package and complain without FindXxx.cmake module should look for the package and complain without
error if the module is not found. error if the module is not found.
FIND_PACKAGE() will set the variable CMAKE_FIND_PACKAGE_NAME to FIND_PACKAGE() will set the variable CMAKE_FIND_PACKAGE_NAME to
@ -133,19 +148,19 @@ contain the actual name of the package.
A package can provide sub-components. A package can provide sub-components.
Those components can be listed after the COMPONENTS (or REQUIRED) Those components can be listed after the COMPONENTS (or REQUIRED)
or OPTIONAL_COMPONENTS keywords. The set of all listed components will be or OPTIONAL_COMPONENTS keywords. The set of all listed components will be
specified in a XXX_FIND_COMPONENTS variable. specified in a Xxx_FIND_COMPONENTS variable.
For each package-specific component, say Yyy, a variable XXX_FIND_REQUIRED_Yyy For each package-specific component, say Yyy, a variable Xxx_FIND_REQUIRED_Yyy
will be set to true if it listed after COMPONENTS and it will be set to false will be set to true if it listed after COMPONENTS and it will be set to false
if it was listed after OPTIONAL_COMPONENTS. if it was listed after OPTIONAL_COMPONENTS.
Using those variables a FindXXX.cmake module and also a XXXConfig.cmake package Using those variables a FindXxx.cmake module and also a XxxConfig.cmake package
configuration file can determine whether and which components have been requested, configuration file can determine whether and which components have been requested,
and whether they were requested as required or as optional. and whether they were requested as required or as optional.
For each of the requested components a XXX_Yyy_FOUND variable should be set For each of the requested components a Xxx_Yyy_FOUND variable should be set
accordingly. accordingly.
The per-package XXX_FOUND variable should be only set to true if all requested The per-package Xxx_FOUND variable should be only set to true if all requested
required components have been found. A missing optional component should not required components have been found. A missing optional component should not
keep the XXX_FOUND variable from being set to true. keep the Xxx_FOUND variable from being set to true.
If the package provides XXX_INCLUDE_DIRS and XXX_LIBRARIES variables, the include If the package provides Xxx_INCLUDE_DIRS and Xxx_LIBRARIES variables, the include
dirs and libraries for all components which were requested and which have been dirs and libraries for all components which were requested and which have been
found should be added to those two variables. found should be added to those two variables.

@ -3,4 +3,4 @@ set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8) set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 11) set(CMake_VERSION_PATCH 11)
set(CMake_VERSION_TWEAK 0) set(CMake_VERSION_TWEAK 0)
set(CMake_VERSION_RC 1) set(CMake_VERSION_RC 3)

@ -771,13 +771,13 @@ static int put_arobj(CF *cfp, struct stat *sb)
} }
if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
(void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname,
(long int)sb->st_mtime, uid, gid, sb->st_mode, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid,
(long long)sb->st_size + lname, ARFMAG); sb->st_mode, (long long)sb->st_size + lname, ARFMAG);
else { else {
lname = 0; lname = 0;
(void)sprintf(ar_hb, HDR2, name, (void)sprintf(ar_hb, HDR2, name,
(long int)sb->st_mtime, uid, gid, sb->st_mode, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid,
(long long)sb->st_size, ARFMAG); sb->st_mode, (long long)sb->st_size, ARFMAG);
} }
off_t size = sb->st_size; off_t size = sb->st_size;

@ -491,7 +491,7 @@ QCMakePropertyList QCMakeCacheModel::properties() const
// go to the next in the tree // go to the next in the tree
while(!idxs.isEmpty() && ( while(!idxs.isEmpty() && (
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 3) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
(idxs.last().row()+1) >= rowCount(idxs.last().parent()) || (idxs.last().row()+1) >= rowCount(idxs.last().parent()) ||
#endif #endif
!idxs.last().sibling(idxs.last().row()+1, 0).isValid())) !idxs.last().sibling(idxs.last().row()+1, 0).isValid()))

@ -35,10 +35,14 @@ bool cmAddDependenciesCommand
} }
else else
{ {
std::string error = "Adding dependency to non-existent target: "; cmOStringStream e;
error += target_name; e << "Cannot add target-level dependencies to non-existent target \""
this->SetError(error.c_str()); << target_name << "\".\n"
return false; << "The add_dependencies works for top-level logical targets created "
<< "by the add_executable, add_library, or add_custom_target commands. "
<< "If you want to add file-level dependencies see the DEPENDS option "
<< "of the add_custom_target and add_custom_command commands.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
} }
return true; return true;

@ -326,6 +326,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{ {
this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"could not write export file."); "could not write export file.");
fclose(fout);
return -1; return -1;
} }
fprintf(fout, fprintf(fout,

@ -1164,14 +1164,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build"); "Variables that Control the Build");
cm->DefineProperty cm->DefineProperty
("CMAKE_BUILD_INTERFACE_INCLUDES", cmProperty::VARIABLE, ("CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE", cmProperty::VARIABLE,
"Automatically add the current source- and build directories " "Automatically add the current source- and build directories "
"to the INTERFACE_INCLUDE_DIRECTORIES.", "to the INTERFACE_INCLUDE_DIRECTORIES.",
"If this variable is enabled, CMake automatically adds for each shared " "If this variable is enabled, CMake automatically adds for each shared "
"library target, static library target, module target and executable " "library target, static library target, module target and executable "
"target, ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} to " "target, ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} to "
"the INTERFACE_INCLUDE_DIRECTORIES." "the INTERFACE_INCLUDE_DIRECTORIES."
"By default CMAKE_BUILD_INTERFACE_INCLUDES is OFF.", "By default CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE is OFF.",
false, false,
"Variables that Control the Build"); "Variables that Control the Build");
@ -1499,7 +1499,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
" PathScale = PathScale (pathscale.com)\n" " PathScale = PathScale (pathscale.com)\n"
" SDCC = Small Device C Compiler (sdcc.sourceforge.net)\n" " SDCC = Small Device C Compiler (sdcc.sourceforge.net)\n"
" SunPro = Oracle Solaris Studio (oracle.com)\n" " SunPro = Oracle Solaris Studio (oracle.com)\n"
" TI_DSP = Texas Instruments (ti.com)\n" " TI = Texas Instruments (ti.com)\n"
" TinyCC = Tiny C Compiler (tinycc.org)\n" " TinyCC = Tiny C Compiler (tinycc.org)\n"
" Watcom = Open Watcom (openwatcom.org)\n" " Watcom = Open Watcom (openwatcom.org)\n"
" XL, VisualAge, zOS = IBM XL (ibm.com)\n" " XL, VisualAge, zOS = IBM XL (ibm.com)\n"

@ -24,6 +24,7 @@
#include "cmComputeLinkInformation.h" #include "cmComputeLinkInformation.h"
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
#include <assert.h>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmExportFileGenerator::cmExportFileGenerator() cmExportFileGenerator::cmExportFileGenerator()
@ -167,6 +168,116 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
} }
} }
//----------------------------------------------------------------------------
static bool isSubDirectory(const char* a, const char* b)
{
return (cmSystemTools::ComparePath(a, b) ||
cmSystemTools::IsSubDirectory(a, b));
}
//----------------------------------------------------------------------------
static bool checkInterfaceDirs(const std::string &prepro,
cmTarget *target)
{
const char* installDir =
target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
const char* topSourceDir = target->GetMakefile()->GetHomeDirectory();
const char* topBinaryDir = target->GetMakefile()->GetHomeOutputDirectory();
std::vector<std::string> parts;
cmGeneratorExpression::Split(prepro, parts);
const bool inSourceBuild = strcmp(topSourceDir, topBinaryDir) == 0;
for(std::vector<std::string>::iterator li = parts.begin();
li != parts.end(); ++li)
{
if (cmGeneratorExpression::Find(*li) != std::string::npos)
{
continue;
}
if (strncmp(li->c_str(), "${_IMPORT_PREFIX}", 17) == 0)
{
continue;
}
if (!cmSystemTools::FileIsFullPath(li->c_str()))
{
cmOStringStream e;
e << "Target \"" << target->GetName() << "\" "
"INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n"
" \"" << *li << "\"";
target->GetMakefile()->IssueMessage(cmake::FATAL_ERROR,
e.str().c_str());
return false;
}
if (isSubDirectory(li->c_str(), installDir))
{
continue;
}
if (isSubDirectory(li->c_str(), topBinaryDir))
{
cmOStringStream e;
e << "Target \"" << target->GetName() << "\" "
"INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the build directory.";
target->GetMakefile()->IssueMessage(cmake::FATAL_ERROR,
e.str().c_str());
return false;
}
if (!inSourceBuild)
{
if (isSubDirectory(li->c_str(), topSourceDir))
{
cmOStringStream e;
e << "Target \"" << target->GetName() << "\" "
"INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the source directory.";
target->GetMakefile()->IssueMessage(cmake::FATAL_ERROR,
e.str().c_str());
return false;
}
}
}
return true;
}
//----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets)
{
assert(preprocessRule == cmGeneratorExpression::InstallInterface);
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
const char *input = target->GetProperty(propName);
if (!input)
{
return;
}
if (!*input)
{
// Set to empty
properties[propName] = "";
return;
}
std::string prepro = cmGeneratorExpression::Preprocess(input,
preprocessRule);
if (!prepro.empty())
{
this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets);
if (!checkInterfaceDirs(prepro, target))
{
return;
}
properties[propName] = prepro;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
cmTarget *target, cmTarget *target,

@ -107,6 +107,11 @@ protected:
ImportPropertyMap &properties); ImportPropertyMap &properties);
void GenerateInterfaceProperties(cmTarget *target, std::ostream& os, void GenerateInterfaceProperties(cmTarget *target, std::ostream& os,
const ImportPropertyMap &properties); const ImportPropertyMap &properties);
void PopulateIncludeDirectoriesInterface(
cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
void SetImportLinkInterface(const char* config, std::string const& suffix, void SetImportLinkInterface(const char* config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,

@ -76,33 +76,36 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{ {
std::string installPrefix = std::string installPrefix =
this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
std::string absDest = installPrefix + "/" + installDest + "/"; std::string absDest = installPrefix + "/" + installDest;
if(strncmp(absDest.c_str(), "/lib/", 5) == 0 || std::string absDestS = absDest + "/";
strncmp(absDest.c_str(), "/lib64/", 7) == 0 || os << "# Compute the installation prefix relative to this file.\n"
strncmp(absDest.c_str(), "/usr/lib/", 9) == 0 || << "get_filename_component(_IMPORT_PREFIX"
strncmp(absDest.c_str(), "/usr/lib64/", 11) == 0) << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
if(strncmp(absDestS.c_str(), "/lib/", 5) == 0 ||
strncmp(absDestS.c_str(), "/lib64/", 7) == 0 ||
strncmp(absDestS.c_str(), "/usr/lib/", 9) == 0 ||
strncmp(absDestS.c_str(), "/usr/lib64/", 11) == 0)
{ {
// Assume this is a build for system package installation rather than a // Handle "/usr move" symlinks created by some Linux distros.
// relocatable distribution. Use an absolute prefix because some Linux os <<
// distros symlink /lib to /usr/lib which confuses the relative path "# Use original install prefix when loaded through a\n"
// computation below if we generate for /lib under one prefix and but the "# cross-prefix symbolic link such as /lib -> /usr/lib.\n"
// file is loaded from another. "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n"
os << "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n"; "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n"
"if(_realCurr STREQUAL _realOrig)\n"
" set(_IMPORT_PREFIX \"" << absDest << "\")\n"
"endif()\n"
"unset(_realOrig)\n"
"unset(_realCurr)\n";
} }
else std::string dest = installDest;
while(!dest.empty())
{ {
std::string dest = installDest; os <<
os << "# Compute the installation prefix relative to this file.\n" "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n";
<< "get_filename_component(_IMPORT_PREFIX " dest = cmSystemTools::GetFilenamePath(dest);
<< "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
while(!dest.empty())
{
os <<
"get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n";
dest = cmSystemTools::GetFilenamePath(dest);
}
os << "\n";
} }
os << "\n";
// Import location properties may reference this variable. // Import location properties may reference this variable.
this->ImportPrefix = "${_IMPORT_PREFIX}/"; this->ImportPrefix = "${_IMPORT_PREFIX}/";
@ -120,8 +123,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
ImportPropertyMap properties; ImportPropertyMap properties;
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", this->PopulateIncludeDirectoriesInterface(te,
te,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",

@ -621,7 +621,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
->GetGeneratorTarget(target); ->GetGeneratorTarget(target);
// the compilerdefines for this target // the compilerdefines for this target
std::string cdefs = target->GetCompileDefinitions(); std::string cdefs = target->GetCompileDefinitions(buildType);
if(!cdefs.empty()) if(!cdefs.empty())
{ {
@ -640,10 +640,8 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::set<std::string> uniqIncludeDirs; std::set<std::string> uniqIncludeDirs;
std::vector<std::string> includes; std::vector<std::string> includes;
const char *config = target->GetMakefile()
->GetDefinition("CMAKE_BUILD_TYPE");
target->GetMakefile()->GetLocalGenerator()-> target->GetMakefile()->GetLocalGenerator()->
GetIncludeDirectories(includes, gtgt, "C", config); GetIncludeDirectories(includes, gtgt, "C", buildType);
for(std::vector<std::string>::const_iterator dirIt=includes.begin(); for(std::vector<std::string>::const_iterator dirIt=includes.begin();
dirIt != includes.end(); dirIt != includes.end();
++dirIt) ++dirIt)

@ -488,12 +488,11 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
lg->AppendDefines(defines, target->GetCompileDefinitions()); lg->AppendDefines(defines, target->GetCompileDefinitions(config));
lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
{ {
std::string defPropName = "COMPILE_DEFINITIONS_"; std::string defPropName = "COMPILE_DEFINITIONS_";
defPropName += cmSystemTools::UpperCase(config); defPropName += cmSystemTools::UpperCase(config);
lg->AppendDefines(defines, target->GetCompileDefinitions(config));
lg->AppendDefines(defines, source->GetProperty(defPropName.c_str())); lg->AppendDefines(defines, source->GetProperty(defPropName.c_str()));
} }

@ -236,9 +236,29 @@ static std::string stripExportInterface(const std::string &input,
std::string::size_type pos = 0; std::string::size_type pos = 0;
std::string::size_type lastPos = pos; std::string::size_type lastPos = pos;
while((pos = input.find("$<BUILD_INTERFACE:", lastPos)) != input.npos while (true)
|| (pos = input.find("$<INSTALL_INTERFACE:", lastPos)) != input.npos)
{ {
std::string::size_type bPos = input.find("$<BUILD_INTERFACE:", lastPos);
std::string::size_type iPos = input.find("$<INSTALL_INTERFACE:", lastPos);
if (bPos == std::string::npos && iPos == std::string::npos)
{
break;
}
if (bPos == std::string::npos)
{
pos = iPos;
}
else if (iPos == std::string::npos)
{
pos = bPos;
}
else
{
pos = (bPos < iPos) ? bPos : iPos;
}
result += input.substr(lastPos, pos - lastPos); result += input.substr(lastPos, pos - lastPos);
const bool gotInstallInterface = input[pos + 2] == 'I'; const bool gotInstallInterface = input[pos + 2] == 'I';
pos += gotInstallInterface ? sizeof("$<INSTALL_INTERFACE:") - 1 pos += gotInstallInterface ? sizeof("$<INSTALL_INTERFACE:") - 1

@ -62,15 +62,16 @@ public:
virtual const char* GetFullDocumentation() const virtual const char* GetFullDocumentation() const
{ {
return return
" get_filename_component(<VAR> FileName\n" " get_filename_component(<VAR> <FileName> <COMP> [CACHE])\n"
" PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH\n" "Set <VAR> to a component of <FileName>, where <COMP> is one of:\n"
" [CACHE])\n" " PATH = Directory without file name\n"
"Set <VAR> to be the path (PATH), file name (NAME), file " " NAME = File name without directory\n"
"extension (EXT), file name without extension (NAME_WE) of FileName, " " EXT = File name longest extension (.b.c from d/a.b.c)\n"
"the full path (ABSOLUTE), or the full path with all symlinks " " NAME_WE = File name without directory or longest extension\n"
"resolved (REALPATH). " " ABSOLUTE = Full path to file\n"
"Note that the path is converted to Unix slashes format and has no " " REALPATH = Full path to existing file with symlinks resolved\n"
"trailing slashes. The longest file extension is always considered. " "Paths are returned with forward slashes and have no trailing slahes. "
"The longest file extension is always considered. "
"If the optional CACHE argument is specified, the result variable is " "If the optional CACHE argument is specified, the result variable is "
"added to the cache.\n" "added to the cache.\n"
" get_filename_component(<VAR> FileName\n" " get_filename_component(<VAR> FileName\n"

@ -102,7 +102,14 @@ void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
{ {
fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n";
fout << "# Visual Studio 2010\n"; if (this->ExpressEdition)
{
fout << "# Visual C++ Express 2010\n";
}
else
{
fout << "# Visual Studio 2010\n";
}
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator

@ -81,7 +81,14 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
{ {
fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
fout << "# Visual Studio 11\n"; if (this->ExpressEdition)
{
fout << "# Visual Studio Express 2012 for Windows Desktop\n";
}
else
{
fout << "# Visual Studio 2012\n";
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

@ -1709,12 +1709,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs, exportMacro); this->AppendDefines(ppDefs, exportMacro);
} }
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
this->AppendDefines(ppDefs, target.GetCompileDefinitions().c_str()); this->AppendDefines(ppDefs,
if(configName) target.GetCompileDefinitions(configName).c_str());
{
this->AppendDefines(ppDefs,
target.GetCompileDefinitions(configName).c_str());
}
buildSettings->AddAttribute buildSettings->AddAttribute
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());

@ -1407,20 +1407,22 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return; return;
} }
if (stripImplicitInclDirs) std::vector<std::string> implicitDirs;
{ // Load implicit include directories for this language.
// Load implicit include directories for this language. std::string impDirVar = "CMAKE_";
std::string impDirVar = "CMAKE_"; impDirVar += lang;
impDirVar += lang; impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str()))
if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str())) {
{ std::vector<std::string> impDirVec;
std::vector<std::string> impDirVec; cmSystemTools::ExpandListArgument(value, impDirVec);
cmSystemTools::ExpandListArgument(value, impDirVec); for(std::vector<std::string>::const_iterator i = impDirVec.begin();
for(std::vector<std::string>::const_iterator i = impDirVec.begin(); i != impDirVec.end(); ++i)
i != impDirVec.end(); ++i) {
emitted.insert(*i);
if (!stripImplicitInclDirs)
{ {
emitted.insert(*i); implicitDirs.push_back(*i);
} }
} }
} }
@ -1463,6 +1465,15 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
dirs.push_back(*i); dirs.push_back(*i);
} }
} }
for(std::vector<std::string>::const_iterator i = implicitDirs.begin();
i != implicitDirs.end(); ++i)
{
if(std::find(includes.begin(), includes.end(), *i) != includes.end())
{
dirs.push_back(*i);
}
}
} }
void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,

@ -1962,7 +1962,6 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target. // Build a list of preprocessor definitions for the target.
std::set<std::string> defines; std::set<std::string> defines;
this->AppendDefines(defines, target.GetCompileDefinitions());
this->AppendDefines(defines, target.GetCompileDefinitions( this->AppendDefines(defines, target.GetCompileDefinitions(
this->ConfigurationName.c_str())); this->ConfigurationName.c_str()));
if(!defines.empty()) if(!defines.empty())

@ -1702,7 +1702,7 @@ void cmLocalVisualStudio6Generator
this->AppendDefines( this->AppendDefines(
definesSet, definesSet,
target.GetCompileDefinitions()); target.GetCompileDefinitions(0));
this->AppendDefines( this->AppendDefines(
debugDefinesSet, debugDefinesSet,
target.GetCompileDefinitions("DEBUG")); target.GetCompileDefinitions("DEBUG"));

@ -745,7 +745,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.ParseFinish(); targetOptions.ParseFinish();
cmGeneratorTarget* gt = cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target); this->GlobalGenerator->GetGeneratorTarget(&target);
targetOptions.AddDefines(target.GetCompileDefinitions().c_str());
targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str()); targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str());
targetOptions.SetVerboseMakefile( targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));

@ -3458,6 +3458,10 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
if (propname == "INCLUDE_DIRECTORIES") if (propname == "INCLUDE_DIRECTORIES")
{ {
this->IncludeDirectoriesEntries.clear(); this->IncludeDirectoriesEntries.clear();
if (!value)
{
return;
}
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
this->IncludeDirectoriesEntries.push_back( this->IncludeDirectoriesEntries.push_back(

@ -302,9 +302,6 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AppendDefines
(defines, this->Target->GetCompileDefinitions());
this->LocalGenerator->AppendDefines this->LocalGenerator->AppendDefines
(defines, this->Target->GetCompileDefinitions( (defines, this->Target->GetCompileDefinitions(
this->LocalGenerator->ConfigurationName.c_str())); this->LocalGenerator->ConfigurationName.c_str()));
@ -640,18 +637,25 @@ cmMakefileTargetGenerator
(commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild); (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
} }
std::string targetOutPathReal;
std::string targetOutPathPDB; std::string targetOutPathPDB;
{ {
std::string targetFullPathReal;
std::string targetFullPathPDB; std::string targetFullPathPDB;
if(this->Target->GetType() == cmTarget::EXECUTABLE || if(this->Target->GetType() == cmTarget::EXECUTABLE ||
this->Target->GetType() == cmTarget::STATIC_LIBRARY || this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
this->Target->GetType() == cmTarget::SHARED_LIBRARY || this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->GetType() == cmTarget::MODULE_LIBRARY) this->Target->GetType() == cmTarget::MODULE_LIBRARY)
{ {
targetFullPathReal =
this->Target->GetFullPath(this->ConfigName, false, true);
targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName); targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
targetFullPathPDB += "/"; targetFullPathPDB += "/";
targetFullPathPDB += this->Target->GetPDBName(this->ConfigName); targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
} }
targetOutPathReal = this->Convert(targetFullPathReal.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
targetOutPathPDB = targetOutPathPDB =
this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
@ -660,6 +664,7 @@ cmMakefileTargetGenerator
vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
vars.CMTarget = this->Target; vars.CMTarget = this->Target;
vars.Language = lang; vars.Language = lang;
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str(); vars.TargetPDB = targetOutPathPDB.c_str();
vars.Source = sourceFile.c_str(); vars.Source = sourceFile.c_str();
std::string shellObj = std::string shellObj =

@ -228,16 +228,13 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AppendDefines this->LocalGenerator->AppendDefines
(defines, (defines,
this->Target->GetCompileDefinitions()); this->Target->GetCompileDefinitions(this->GetConfigName()));
this->LocalGenerator->AppendDefines this->LocalGenerator->AppendDefines
(defines, (defines,
source->GetProperty("COMPILE_DEFINITIONS")); source->GetProperty("COMPILE_DEFINITIONS"));
{ {
std::string defPropName = "COMPILE_DEFINITIONS_"; std::string defPropName = "COMPILE_DEFINITIONS_";
defPropName += cmSystemTools::UpperCase(this->GetConfigName()); defPropName += cmSystemTools::UpperCase(this->GetConfigName());
this->LocalGenerator->AppendDefines
(defines,
this->Target->GetCompileDefinitions(this->GetConfigName()));
this->LocalGenerator->AppendDefines this->LocalGenerator->AppendDefines
(defines, (defines,
source->GetProperty(defPropName.c_str())); source->GetProperty(defPropName.c_str()));

@ -17,6 +17,10 @@
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
# include "cmLocalVisualStudioGenerator.h"
#endif
#include <cmsys/Terminal.h> #include <cmsys/Terminal.h>
#include <cmsys/ios/sstream> #include <cmsys/ios/sstream>
@ -182,14 +186,44 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
std::string automocComment = "Automoc for target "; std::string automocComment = "Automoc for target ";
automocComment += targetName; automocComment += targetName;
cmTarget* automocTarget = makefile->AddUtilityCommand( #if defined(_WIN32) && !defined(__CYGWIN__)
automocTargetName.c_str(), true, bool usePRE_BUILD = false;
workingDirectory.c_str(), depends, cmGlobalGenerator* gg = localGen->GetGlobalGenerator();
commandLines, false, automocComment.c_str()); if(strstr(gg->GetName(), "Visual Studio"))
// inherit FOLDER property from target (#13688) {
copyTargetProperty(automocTarget, target, "FOLDER"); cmLocalVisualStudioGenerator* vslg =
static_cast<cmLocalVisualStudioGenerator*>(localGen);
target->AddUtility(automocTargetName.c_str()); // Under VS >= 7 use a PRE_BUILD event instead of a separate target to
// reduce the number of targets loaded into the IDE.
// This also works around a VS 11 bug that may skip updating the target:
// https://connect.microsoft.com/VisualStudio/feedback/details/769495
usePRE_BUILD = vslg->GetVersion() >= cmLocalVisualStudioGenerator::VS7;
}
if(usePRE_BUILD)
{
// Add the pre-build command directly to bypass the OBJECT_LIBRARY
// rejection in cmMakefile::AddCustomCommandToTarget because we know
// PRE_BUILD will work for an OBJECT_LIBRARY in this specific case.
std::vector<std::string> no_output;
cmCustomCommand cc(makefile, no_output, depends,
commandLines, automocComment.c_str(),
workingDirectory.c_str());
cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true);
target->GetPreBuildCommands().push_back(cc);
}
else
#endif
{
cmTarget* automocTarget = makefile->AddUtilityCommand(
automocTargetName.c_str(), true,
workingDirectory.c_str(), depends,
commandLines, false, automocComment.c_str());
// inherit FOLDER property from target (#13688)
copyTargetProperty(automocTarget, target, "FOLDER");
target->AddUtility(automocTargetName.c_str());
}
// configure a file to get all information to automoc at buildtime: // configure a file to get all information to automoc at buildtime:
std::string _moc_files; std::string _moc_files;
@ -250,7 +284,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
std::string _moc_compile_defs; std::string _moc_compile_defs;
if (tmp) if (tmp)
{ {
_moc_compile_defs = target->GetCompileDefinitions(); _moc_compile_defs = target->GetCompileDefinitions(0);
} }
tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
if (tmp) if (tmp)

@ -129,8 +129,8 @@ public:
"will search for the position of the last occurrence of the " "will search for the position of the last occurrence of the "
"specified substring.\n" "specified substring.\n"
"The following characters have special meaning in regular expressions:\n" "The following characters have special meaning in regular expressions:\n"
" ^ Matches at beginning of a line\n" " ^ Matches at beginning of input\n"
" $ Matches at end of a line\n" " $ Matches at end of input\n"
" . Matches any single character\n" " . Matches any single character\n"
" [ ] Matches any character(s) inside the brackets\n" " [ ] Matches any character(s) inside the brackets\n"
" [^ ] Matches any character(s) not inside the brackets\n" " [^ ] Matches any character(s) not inside the brackets\n"

@ -203,13 +203,13 @@ std::string cmSystemTools::EscapeQuotes(const char* str)
std::string cmSystemTools::TrimWhitespace(const std::string& s) std::string cmSystemTools::TrimWhitespace(const std::string& s)
{ {
std::string::const_iterator start = s.begin(); std::string::const_iterator start = s.begin();
while(start != s.end() && *start == ' ') while(start != s.end() && *start <= ' ')
++start; ++start;
if (start == s.end()) if (start == s.end())
return ""; return "";
std::string::const_iterator stop = s.end()-1; std::string::const_iterator stop = s.end()-1;
while(*stop == ' ') while(*stop <= ' ')
--stop; --stop;
return std::string(start, stop+1); return std::string(start, stop+1);
} }

@ -131,11 +131,13 @@ public:
SourceEntriesType SourceEntries; SourceEntriesType SourceEntries;
struct IncludeDirectoriesEntry { struct IncludeDirectoriesEntry {
IncludeDirectoriesEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge) IncludeDirectoriesEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
: ge(cge) const std::string &targetName = std::string())
: ge(cge), TargetName(targetName)
{} {}
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
std::vector<std::string> CachedIncludes; std::vector<std::string> CachedIncludes;
const std::string TargetName;
}; };
std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries; std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries;
std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries; std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries;
@ -193,7 +195,8 @@ void cmTarget::DefineProperties(cmake *cm)
"Should the target be processed with automoc (for Qt projects).", "Should the target be processed with automoc (for Qt projects).",
"AUTOMOC is a boolean specifying whether CMake will handle " "AUTOMOC is a boolean specifying whether CMake will handle "
"the Qt moc preprocessor automatically, i.e. without having to use " "the Qt moc preprocessor automatically, i.e. without having to use "
"the QT4_WRAP_CPP() macro. Currently Qt4 is supported. " "the QT4_WRAP_CPP() or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are "
"supported. "
"When this property is set to TRUE, CMake will scan the source files " "When this property is set to TRUE, CMake will scan the source files "
"at build time and invoke moc accordingly. " "at build time and invoke moc accordingly. "
"If an #include statement like #include \"moc_foo.cpp\" is found, " "If an #include statement like #include \"moc_foo.cpp\" is found, "
@ -2744,7 +2747,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
} }
this->BuildInterfaceIncludesAppended = true; this->BuildInterfaceIncludesAppended = true;
if (this->Makefile->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES")) if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE"))
{ {
const char *binDir = this->Makefile->GetStartOutputDirectory(); const char *binDir = this->Makefile->GetStartOutputDirectory();
const char *srcDir = this->Makefile->GetStartDirectory(); const char *srcDir = this->Makefile->GetStartDirectory();
@ -2817,6 +2820,42 @@ static void processIncludeDirectories(cmTarget *tgt,
for(std::vector<std::string>::iterator for(std::vector<std::string>::iterator
li = entryIncludes.begin(); li != entryIncludes.end(); ++li) li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
{ {
cmTarget *dependentTarget =
mf->FindTargetToUse((*it)->TargetName.c_str());
const bool fromImported = dependentTarget
&& dependentTarget->IsImported();
if (fromImported && !cmSystemTools::FileExists(li->c_str()))
{
cmOStringStream e;
e << "Imported target \"" << (*it)->TargetName << "\" includes "
"non-existent path\n \"" << *li << "\"\nin its "
"INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
"* The path was deleted, renamed, or moved to another "
"location.\n"
"* An install or uninstall procedure did not complete "
"successfully.\n"
"* The installation package was faulty and references files it "
"does not provide.\n";
tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return;
}
if (!cmSystemTools::FileIsFullPath(li->c_str()))
{
if (!(*it)->TargetName.empty())
{
cmOStringStream e;
e << "Target \"" << (*it)->TargetName << "\" contains relative "
"path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
" \"" << *li << "\" ";
tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR,
e.str().c_str());
return;
}
}
if (testIsOff && !cmSystemTools::IsOff(li->c_str())) if (testIsOff && !cmSystemTools::IsOff(li->c_str()))
{ {
cmSystemTools::ConvertToUnixSlashes(*li); cmSystemTools::ConvertToUnixSlashes(*li);
@ -2912,7 +2951,8 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>"); it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>");
this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back( this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back(
new cmTargetInternals::IncludeDirectoriesEntry(cge)); new cmTargetInternals::IncludeDirectoriesEntry(cge,
it->Value));
} }
} }
@ -2941,29 +2981,33 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmTarget::GetCompileDefinitions(const char *config) std::string cmTarget::GetCompileDefinitions(const char *config)
{ {
std::string defPropName = "COMPILE_DEFINITIONS"; const char *configProp = 0;
if (config) if (config)
{ {
defPropName += "_" + cmSystemTools::UpperCase(config); std::string configPropName;
configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config);
configProp = this->GetProperty(configPropName.c_str());
} }
const char *prop = this->GetProperty(defPropName.c_str()); const char *noconfigProp = this->GetProperty("COMPILE_DEFINITIONS");
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(lfbt,
this->GetName(), this->GetName(),
defPropName, 0, 0); "COMPILE_DEFINITIONS", 0, 0);
std::string result; std::string defsString = (noconfigProp ? noconfigProp : "");
if (prop) if (configProp && noconfigProp)
{ {
cmGeneratorExpression ge(lfbt); defsString += ";";
result = ge.Parse(prop)->Evaluate(this->Makefile,
config,
false,
this,
&dagChecker);
} }
defsString += (configProp ? configProp : "");
cmGeneratorExpression ge(lfbt);
std::string result = ge.Parse(defsString.c_str())->Evaluate(this->Makefile,
config,
false,
this,
&dagChecker);
std::vector<std::string> libs; std::vector<std::string> libs;
this->GetDirectLinkLibraries(config, libs, this); this->GetDirectLinkLibraries(config, libs, this);

@ -430,7 +430,7 @@ public:
If no macro should be defined null is returned. */ If no macro should be defined null is returned. */
const char* GetExportMacro(); const char* GetExportMacro();
std::string GetCompileDefinitions(const char *config = 0); std::string GetCompileDefinitions(const char *config);
// Compute the set of languages compiled by the target. This is // Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change // computed every time it is called because the languages can change

@ -56,8 +56,7 @@ public:
" target_compile_definitions(<target> " " target_compile_definitions(<target> "
"<INTERFACE|PUBLIC|PRIVATE> [items1...]\n" "<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
" [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n" " [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
"Specify compile definitions or targets to use when compiling a given " "Specify compile definitions to use when compiling a given target. "
"target. "
"The named <target> must have been created by a command such as " "The named <target> must have been created by a command such as "
"add_executable or add_library and must not be an IMPORTED target. " "add_executable or add_library and must not be an IMPORTED target. "
"The INTERFACE, PUBLIC and PRIVATE keywords are required to specify " "The INTERFACE, PUBLIC and PRIVATE keywords are required to specify "
@ -65,8 +64,7 @@ public:
"populate the COMPILE_DEFINITIONS property of <target>. PUBLIC and " "populate the COMPILE_DEFINITIONS property of <target>. PUBLIC and "
"INTERFACE items will populate the INTERFACE_COMPILE_DEFINITIONS " "INTERFACE items will populate the INTERFACE_COMPILE_DEFINITIONS "
"property of <target>. " "property of <target>. "
"The non-scope arguments specify compile definitions or targets to use " "The following arguments specify compile definitions. "
"INTERFACE_COMPILE_DEFINITIONS from. "
"Repeated calls for the same <target> append items in the order called." "Repeated calls for the same <target> append items in the order called."
"\n" "\n"
"Arguments to target_compile_definitions may use \"generator " "Arguments to target_compile_definitions may use \"generator "

@ -68,9 +68,8 @@ public:
"populate the INCLUDE_DIRECTORIES property of <target>. PUBLIC and " "populate the INCLUDE_DIRECTORIES property of <target>. PUBLIC and "
"INTERFACE items will populate the INTERFACE_INCLUDE_DIRECTORIES " "INTERFACE items will populate the INTERFACE_INCLUDE_DIRECTORIES "
"property of <target>. " "property of <target>. "
"The non-scope arguments specify either include directories or targets " "The following arguments specify include directories. Specified "
"to use INTERFACE_INCLUDE_DIRECTORIES from. Any specified include " "include directories may be absolute paths or relative paths. "
"directories must be absolute paths, not relative paths. "
"Repeated calls for the same <target> append items in the order called." "Repeated calls for the same <target> append items in the order called."
"\n" "\n"
"Arguments to target_include_directories may use \"generator " "Arguments to target_include_directories may use \"generator "

@ -1220,8 +1220,6 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("PrecompiledHeader", "NotUsing"); clOptions.AddFlag("PrecompiledHeader", "NotUsing");
clOptions.Parse(flags.c_str()); clOptions.Parse(flags.c_str());
clOptions.Parse(defineFlags.c_str()); clOptions.Parse(defineFlags.c_str());
clOptions.AddDefines(
this->Target->GetCompileDefinitions().c_str());
clOptions.AddDefines(this->Target->GetCompileDefinitions( clOptions.AddDefines(this->Target->GetCompileDefinitions(
configName.c_str()).c_str()); configName.c_str()).c_str());
clOptions.SetVerboseMakefile( clOptions.SetVerboseMakefile(

@ -47,6 +47,12 @@ do.
*/ */
#if defined(__CYGWIN__)
/* Increase the file descriptor limit for select() before including
related system headers. (Default: 64) */
# define FD_SETSIZE 16384
#endif
#include <stddef.h> /* ptrdiff_t */ #include <stddef.h> /* ptrdiff_t */
#include <stdio.h> /* snprintf */ #include <stdio.h> /* snprintf */
#include <stdlib.h> /* malloc, free */ #include <stdlib.h> /* malloc, free */

@ -130,7 +130,7 @@ typedef int siginfo_t;
# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN # define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
# endif # endif
# endif # endif
# if defined(__GNUG__) # if defined(__GNUC__)
# include <execinfo.h> # include <execinfo.h>
# if !(defined(__LSB_VERSION__) && __LSB_VERSION__ < 41) # if !(defined(__LSB_VERSION__) && __LSB_VERSION__ < 41)
# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE # define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE

@ -1,5 +1,5 @@
set(CMAKE_BUILD_INTERFACE_INCLUDES ON) set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
add_library(subdirlib SHARED subdirlib.cpp) add_library(subdirlib SHARED subdirlib.cpp)
generate_export_header(subdirlib) generate_export_header(subdirlib)

@ -7,10 +7,19 @@ if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6")
add_definitions(-DNO_SPACES_IN_DEFINE_VALUES) add_definitions(-DNO_SPACES_IN_DEFINE_VALUES)
endif() endif()
# Use compile flags to tell executables which config is built
# without depending on the compile definitions functionality.
foreach(c DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
set(CMAKE_C_FLAGS_${c} "${CMAKE_C_FLAGS_${c}} -DTEST_CONFIG_${c}")
set(CMAKE_CXX_FLAGS_${c} "${CMAKE_CXX_FLAGS_${c}} -DTEST_CONFIG_${c}")
endforeach()
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
"BUILD_CONFIG_NAME=\"$<CONFIGURATION>\""
)
add_subdirectory(add_definitions_command) add_subdirectory(add_definitions_command)
add_subdirectory(target_prop) add_subdirectory(target_prop)
add_subdirectory(add_definitions_command_with_target_prop) add_subdirectory(add_definitions_command_with_target_prop)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp" "int main(int, char **) { return 0; }\n") add_executable(CompileDefinitions runtest.c)
add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp")

@ -3,5 +3,6 @@ project(add_definitions_command)
add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun") add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun")
add_definitions(-DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun" -DCMAKE_IS_FUN -DCMAKE_IS=Fun) add_definitions(-DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun" -DCMAKE_IS_FUN -DCMAKE_IS=Fun)
add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug> -DBUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>)
add_executable(add_definitions_command_executable ../compiletest.cpp) add_executable(add_definitions_command_executable ../compiletest.cpp)

@ -12,3 +12,6 @@ set_property(TARGET add_definitions_command_with_target_prop_executable APPEND P
add_definitions(-DCMAKE_IS_FUN) add_definitions(-DCMAKE_IS_FUN)
set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun") set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun")
add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug>)
set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>)

@ -45,6 +45,30 @@ enum {
// TEST_GENERATOR_EXPRESSIONS // TEST_GENERATOR_EXPRESSIONS
#endif #endif
#ifndef BUILD_IS_DEBUG
# error "BUILD_IS_DEBUG not defined!"
#endif
#ifndef BUILD_IS_NOT_DEBUG
# error "BUILD_IS_NOT_DEBUG not defined!"
#endif
// Check per-config definitions.
#ifdef TEST_CONFIG_DEBUG
# if !BUILD_IS_DEBUG
# error "BUILD_IS_DEBUG false with TEST_CONFIG_DEBUG!"
# endif
# if BUILD_IS_NOT_DEBUG
# error "BUILD_IS_NOT_DEBUG true with TEST_CONFIG_DEBUG!"
# endif
#else
# if BUILD_IS_DEBUG
# error "BUILD_IS_DEBUG true without TEST_CONFIG_DEBUG!"
# endif
# if !BUILD_IS_NOT_DEBUG
# error "BUILD_IS_NOT_DEBUG false without TEST_CONFIG_DEBUG!"
# endif
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
return 0; return 0;

@ -0,0 +1,47 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#ifndef BUILD_CONFIG_NAME
# error "BUILD_CONFIG_NAME not defined!"
#endif
int main()
{
char build_config_name[] = BUILD_CONFIG_NAME;
char* c;
for(c = build_config_name; *c; ++c)
{
*c = (char)tolower((int)*c);
}
fprintf(stderr, "build_config_name=\"%s\"\n", build_config_name);
#ifdef TEST_CONFIG_DEBUG
if(strcmp(build_config_name, "debug") != 0)
{
fprintf(stderr, "build_config_name is not \"debug\"\n");
return 1;
}
#endif
#ifdef TEST_CONFIG_RELEASE
if(strcmp(build_config_name, "release") != 0)
{
fprintf(stderr, "build_config_name is not \"release\"\n");
return 1;
}
#endif
#ifdef TEST_CONFIG_MINSIZEREL
if(strcmp(build_config_name, "minsizerel") != 0)
{
fprintf(stderr, "build_config_name is not \"minsizerel\"\n");
return 1;
}
#endif
#ifdef TEST_CONFIG_RELWITHDEBINFO
if(strcmp(build_config_name, "relwithdebinfo") != 0)
{
fprintf(stderr, "build_config_name is not \"relwithdebinfo\"\n");
return 1;
}
#endif
return 0;
}

@ -14,3 +14,8 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
"$<0:GE_NOT_DEFINED>" "$<0:GE_NOT_DEFINED>"
"$<1:ARGUMENT;LIST>" "$<1:ARGUMENT;LIST>"
) )
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
BUILD_IS_DEBUG=$<CONFIG:Debug>
BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>
)

@ -148,6 +148,10 @@ set_property(TARGET testLibRequired APPEND PROPERTY
$<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired4,INTERFACE_INCLUDE_DIRECTORIES>> $<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired4,INTERFACE_INCLUDE_DIRECTORIES>>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired5,INTERFACE_INCLUDE_DIRECTORIES>> $<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired5,INTERFACE_INCLUDE_DIRECTORIES>>
$<INSTALL_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired6,INTERFACE_INCLUDE_DIRECTORIES>> $<INSTALL_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired6,INTERFACE_INCLUDE_DIRECTORIES>>
# The BUILD_INTERFACE entry from above is duplicated below. This is to test that
# the INSTALL_INTERFACE entry bound by a BUILD_INTERFACE entry on either side is
# preprocessed correctly on install(EXPORT).
$<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired5,INTERFACE_INCLUDE_DIRECTORIES>>
# Test that the below is non-fatal # Test that the below is non-fatal
$<$<STREQUAL:one,two>:$<TARGET_PROPERTY:not_a_target,INTERFACE_INCLUDE_DIRECTORIES>> $<$<STREQUAL:one,two>:$<TARGET_PROPERTY:not_a_target,INTERFACE_INCLUDE_DIRECTORIES>>
) )
@ -170,9 +174,14 @@ set_property(TARGET testSharedLibRequired
set_property(TARGET testSharedLibRequired APPEND PROPERTY set_property(TARGET testSharedLibRequired APPEND PROPERTY
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}"
) )
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/testSharedLibRequired.h"
"${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequired_export.h"
DESTINATION include/testSharedLibRequired
)
set_property(TARGET testSharedLibRequired APPEND PROPERTY set_property(TARGET testSharedLibRequired APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/testSharedLibRequired>"
"${CMAKE_CURRENT_SOURCE_DIR}" "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
) )
set_property(TARGET testSharedLibRequired set_property(TARGET testSharedLibRequired
APPEND PROPERTY APPEND PROPERTY
@ -201,6 +210,15 @@ set_property(TARGET testSharedLibDepends APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:testSharedLibRequired,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:testSharedLibRequired,INTERFACE_INCLUDE_DIRECTORIES>
) )
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/testSharedLibDepends.h"
"${CMAKE_CURRENT_BINARY_DIR}/testsharedlibdepends_export.h"
DESTINATION include/testSharedLibDepends
)
set_property(TARGET testSharedLibDepends APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/testSharedLibDepends>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
)
set_property(TARGET testSharedLibDepends APPEND PROPERTY set_property(TARGET testSharedLibDepends APPEND PROPERTY
LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>> $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>
@ -287,7 +305,7 @@ if(WIN32)
install(TARGETS testLib5 RUNTIME DESTINATION bin) install(TARGETS testLib5 RUNTIME DESTINATION bin)
endif() endif()
add_subdirectory(sublib) # For CMAKE_BUILD_INTERFACE_INCLUDES test. add_subdirectory(sublib) # For CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE test.
# Export from build tree. # Export from build tree.
export(TARGETS testExe1 testLib1 testLib2 testLib3 export(TARGETS testExe1 testLib1 testLib2 testLib3

@ -1,5 +1,5 @@
set(CMAKE_BUILD_INTERFACE_INCLUDES ON) set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(subdirlib SHARED subdir.cpp) add_library(subdirlib SHARED subdir.cpp)

@ -47,3 +47,14 @@ else()
endif() endif()
add_subdirectory(TargetIncludeDirectories) add_subdirectory(TargetIncludeDirectories)
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}")
get_property(propContent DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
if (NOT propContent STREQUAL "${CMAKE_BINARY_DIR}")
message(SEND_ERROR "Setting DIRECTORY property failed.")
endif()
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
get_property(propContentAfter DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
if (NOT propContentAfter STREQUAL "")
message(SEND_ERROR "Clearing DIRECTORY property failed.")
endif()

@ -1,7 +1,7 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_BUILD_INTERFACE_INCLUDES ON) set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
add_library(libA SHARED libA.cpp) add_library(libA SHARED libA.cpp)
target_link_libraries(libA LINK_PUBLIC Qt4::QtCore) target_link_libraries(libA LINK_PUBLIC Qt4::QtCore)

@ -1,7 +1,7 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_BUILD_INTERFACE_INCLUDES ON) set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
add_library(libB SHARED libB.cpp) add_library(libB SHARED libB.cpp)
generate_export_header(libB) generate_export_header(libB)

@ -25,7 +25,7 @@ set_target_properties(foo codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE)
include(GenerateExportHeader) include(GenerateExportHeader)
# The order is relevant here. B depends on A, and B headers depend on A # The order is relevant here. B depends on A, and B headers depend on A
# headers both subdirectories use CMAKE_BUILD_INTERFACE_INCLUDES and we # headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we
# test that CMAKE_AUTOMOC successfully reads the include directories # test that CMAKE_AUTOMOC successfully reads the include directories
# for the build interface from those targets. There has previously been # for the build interface from those targets. There has previously been
# a bug where caching of the include directories happened before # a bug where caching of the include directories happened before

@ -68,6 +68,7 @@ if(NOT WIN32)
endif() endif()
add_RunCMake_test(CompatibleInterface) add_RunCMake_test(CompatibleInterface)
add_RunCMake_test(add_dependencies)
add_RunCMake_test(build_command) add_RunCMake_test(build_command)
add_RunCMake_test(find_package) add_RunCMake_test(find_package)
add_RunCMake_test(include) add_RunCMake_test(include)
@ -75,6 +76,12 @@ add_RunCMake_test(include_directories)
add_RunCMake_test(list) add_RunCMake_test(list)
add_RunCMake_test(CMP0004) add_RunCMake_test(CMP0004)
find_package(Qt4 QUIET)
find_package(Qt5Core QUIET)
if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
add_RunCMake_test(IncompatibleQt)
endif()
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]") if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
add_RunCMake_test(include_external_msproject) add_RunCMake_test(include_external_msproject)
add_RunCMake_test(SolutionGlobalSections) add_RunCMake_test(SolutionGlobalSections)

@ -3,8 +3,6 @@ add_library(foo UNKNOWN IMPORTED)
add_library(bar UNKNOWN IMPORTED) add_library(bar UNKNOWN IMPORTED)
set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING INCLUDE_DIRECTORIES) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING INCLUDE_DIRECTORIES)
set_property(TARGET foo PROPERTY INTERFACE_INCLUDE_DIRECTORIES foo_inc)
set_property(TARGET bar PROPERTY INTERFACE_INCLUDE_DIRECTORIES bar_inc)
add_executable(user main.cpp) add_executable(user main.cpp)
set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES bar_inc) set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES bar_inc)

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)

@ -0,0 +1,3 @@
CMake Error: The INTERFACE_QT_MAJOR_VERSION property of "Qt5::Core" does
not agree with the value of QT_MAJOR_VERSION already determined
for "mainexe".

@ -0,0 +1,6 @@
find_package(Qt4 REQUIRED)
find_package(Qt5Core REQUIRED)
add_executable(mainexe main.cpp)
target_link_libraries(mainexe Qt4::QtCore Qt5::Core)

@ -0,0 +1,3 @@
include(RunCMake)
run_cmake(IncompatibleQt)

@ -0,0 +1,8 @@
#include <QCoreApplication>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
return app.exec();
}

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

@ -0,0 +1,9 @@
CMake Error at NoTarget.cmake:1 \(add_dependencies\):
Cannot add target-level dependencies to non-existent target "foo".
The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

@ -0,0 +1,3 @@
include(RunCMake)
run_cmake(NoTarget)

@ -0,0 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*RunCMake/include_directories/BinaryDirectoryInInterface-build/foo"
which is prefixed in the build directory.

@ -0,0 +1,11 @@
project(BinaryDirectoryInInterface)
add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/foo")
install(TARGETS testTarget EXPORT testTargets
DESTINATION lib
)
install(EXPORT testTargets DESTINATION lib/cmake)

@ -0,0 +1,13 @@
CMake Error in CMakeLists.txt:
Imported target "imported" includes non-existent path
"/does/not/exist"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
\* The path was deleted, renamed, or moved to another location.
\* An install or uninstall procedure did not complete successfully.
\* The installation package was faulty and references files it does not
provide.

@ -0,0 +1,9 @@
project(ImportedTarget)
add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
add_library(imported UNKNOWN IMPORTED)
set_property(TARGET imported PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/does/not/exist")
target_link_libraries(testTarget imported)

@ -0,0 +1,5 @@
CMake Error in CMakeLists.txt:
Target "testTarget" contains relative path in its
INTERFACE_INCLUDE_DIRECTORIES:
"foo"

@ -0,0 +1,8 @@
project(RelativePathInInterface)
add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>")
add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
target_link_libraries(userTarget testTarget)

@ -0,0 +1,5 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains
relative path:
"foo"

@ -0,0 +1,11 @@
project(RelativePathInInterface)
add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo")
install(TARGETS testTarget EXPORT testTargets
DESTINATION lib
)
install(EXPORT testTargets DESTINATION lib/cmake)

@ -3,3 +3,8 @@ include(RunCMake)
run_cmake(NotFoundContent) run_cmake(NotFoundContent)
run_cmake(DebugIncludes) run_cmake(DebugIncludes)
run_cmake(TID-bad-target) run_cmake(TID-bad-target)
run_cmake(SourceDirectoryInInterface)
run_cmake(BinaryDirectoryInInterface)
run_cmake(RelativePathInInterface)
run_cmake(ImportedTarget)
run_cmake(RelativePathInGenex)

@ -0,0 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*RunCMake/include_directories/foo"
which is prefixed in the source directory.

@ -0,0 +1,11 @@
project(SourceDirectoryInInterface)
add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/foo")
install(TARGETS testTarget EXPORT testTargets
DESTINATION lib
)
install(EXPORT testTargets DESTINATION lib/cmake)
Loading…
Cancel
Save