diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake index f052a3bf1..1256f563e 100644 --- a/Modules/CMakeIOSInstallCombined.cmake +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -52,7 +52,14 @@ function(_ios_install_combined_get_build_setting sdk variable resultvar) endif() if(NOT output MATCHES " ${variable} = ([^\n]*)") - message(FATAL_ERROR "${variable} not found.") + if("${variable}" STREQUAL "VALID_ARCHS") + # VALID_ARCHS may be unset by user for given SDK + # (e.g. for build without simulator). + set("${resultvar}" "" PARENT_SCOPE) + return() + else() + message(FATAL_ERROR "${variable} not found.") + endif() endif() set("${resultvar}" "${CMAKE_MATCH_1}" PARENT_SCOPE) @@ -72,6 +79,9 @@ function(_ios_install_combined_get_valid_archs sdk resultvar) list(REMOVE_ITEM valid_archs "") # remove empty elements list(REMOVE_DUPLICATES valid_archs) + string(REPLACE ";" " " printable "${valid_archs}") + _ios_install_combined_message("Architectures (${sdk}): ${printable}") + set("${resultvar}" "${valid_archs}" PARENT_SCOPE) endfunction() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index c3058eaec..728dcdfdf 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -745,9 +745,10 @@ endfunction() # defined; FALSE if dependency information is unavailable). # # componentvar - the component list variable name +# extravar - the indirect dependency list variable name # # -function(_Boost_MISSING_DEPENDENCIES componentvar) +function(_Boost_MISSING_DEPENDENCIES componentvar extravar) # _boost_unprocessed_components - list of components requiring processing # _boost_processed_components - components already processed (or currently being processed) # _boost_new_components - new components discovered for future processing @@ -773,7 +774,12 @@ function(_Boost_MISSING_DEPENDENCIES componentvar) set(_boost_unprocessed_components ${_boost_new_components}) unset(_boost_new_components) endwhile() + set(_boost_extra_components ${_boost_processed_components}) + if(_boost_extra_components AND ${componentvar}) + list(REMOVE_ITEM _boost_extra_components ${${componentvar}}) + endif() set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) + set(${extravar} ${_boost_extra_components} PARENT_SCOPE) endfunction() # @@ -1306,7 +1312,7 @@ endif() # Additional components may be required via component dependencies. # Add any missing components to the list. -_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) # If thread is required, get the thread libs as a dependency list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) @@ -1484,6 +1490,10 @@ if(Boost_FOUND) list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) endif() endforeach() + if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS) + # Optional indirect dependencies are not counted as missing. + list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS}) + endif() if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 47c03f32a..fe8b18ee3 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1551,7 +1551,12 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options list( FIND nvcc_flags "-ccbin" ccbin_found0 ) list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 ) if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER ) - list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"") + # Match VERBATIM check below. + if(CUDA_HOST_COMPILER MATCHES "\\$\\(VCInstallDir\\)") + list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"") + else() + list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}") + endif() endif() # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} and CMAKE_${CUDA_C_OR_CXX}_FLAGS* diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 4f50e3819..447c52622 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -383,7 +383,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir") pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir") foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) - _pkgconfig_set("${_pkg_check_modules_pkg}_${variable}" "${${_pkg_check_modules_pkg}_${variable}}") + _pkgconfig_set("${_pkg_check_prefix}_${variable}" "${${_pkg_check_prefix}_${variable}}") endforeach () if (NOT ${_is_silent}) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index ab70568d3..4ef0e8047 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -728,7 +728,20 @@ endif() add_library(CPackLib ${CPACK_SRCS}) target_link_libraries(CPackLib CMakeLib) if(APPLE) - target_link_libraries(CPackLib "-framework Carbon") + # Some compilers produce errors in the CoreServices framework headers. + # Ideally such errors should be fixed by either the compiler vendor + # or the framework source, but we try to workaround it and build anyway. + # If it does not work, build with reduced functionality and warn. + check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices) + if(HAVE_CoreServices) + set_property(SOURCE CPack/cmCPackDragNDropGenerator.cxx PROPERTY COMPILE_DEFINITIONS HAVE_CoreServices) + target_link_libraries(CPackLib "-framework CoreServices") + else() + message(WARNING "This compiler does not appear to support\n" + " #include \n" + "Some CPack functionality may be limited.\n" + "See CMakeFiles/CMakeError.log for details of the failure.") + endif() endif() if(APPLE) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 129a882b3..683da4376 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) -set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_PATCH 1) #set(CMake_VERSION_RC 0) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 7b94ca3c0..d6de77df9 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -20,20 +20,13 @@ #include -#include -#include -#include +#include -// The carbon framework is deprecated, but the Region codes it supplies are -// needed for the LPic data structure used for generating multi-lingual SLAs. -// There does not seem to be a replacement API for these region codes. -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif -#include -#if defined(__clang__) -# pragma clang diagnostic pop +#ifdef HAVE_CoreServices +// For the old LocaleStringToLangAndRegionCodes() function, to convert +// to the old Script Manager RegionCode values needed for the 'LPic' data +// structure used for generating multi-lingual SLAs. +#include #endif static const char* SLAHeader = @@ -652,9 +645,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, kCFStringEncodingMacRoman); LangCode lang = 0; RegionCode region = 0; +#ifdef HAVE_CoreServices OSStatus err = LocaleStringToLangAndRegionCodes(iso_language_cstr, &lang, ®ion); if (err != noErr) +#endif { cmCPackLogger(cmCPackLog::LOG_ERROR, "No language/region code available for " << iso_language_cstr @@ -662,10 +657,12 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, free(iso_language_cstr); return 0; } +#ifdef HAVE_CoreServices free(iso_language_cstr); header_data.push_back(region); header_data.push_back(i); header_data.push_back(0); +#endif } ofs << "data 'LPic' (5000) {\n"; ofs << std::hex << std::uppercase << std::setfill('0'); diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index f17de5d50..a906f4a6f 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -173,6 +173,7 @@ if(APPLE) MACOSX_BUNDLE_SHORT_VERSION_STRING "${CMAKE_BUNDLE_VERSION}" # TBD: MACOSX_BUNDLE_BUNDLE_VERSION "${CMAKE_BUNDLE_VERSION}" MACOSX_BUNDLE_COPYRIGHT "${copyright_line}" + MACOSX_BUNDLE_GUI_IDENTIFIER "org.cmake.cmake" ) # Create a symlink in the build tree to provide a "cmake-gui" next diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 950b24735..600c985f0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2531,15 +2531,22 @@ const char* cmMakefile::GetDefinition(const std::string& name) const cmVariableWatch* vv = this->GetVariableWatch(); if ( vv && !this->SuppressWatches ) { - if ( def ) - { - vv->VariableAccessed(name, cmVariableWatch::VARIABLE_READ_ACCESS, - def, this); - } - else - { + bool const watch_function_executed = vv->VariableAccessed(name, - cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS, def, this); + def ? cmVariableWatch::VARIABLE_READ_ACCESS + : cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS, + def, this); + + if (watch_function_executed) + { + // A callback was executed and may have caused re-allocation of the + // variable storage. Look it up again for now. + // FIXME: Refactor variable storage to avoid this problem. + def = this->StateSnapshot.GetDefinition(name); + if(!def) + { + def = this->GetState()->GetInitializedCacheValue(name); + } } } #endif diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index 57dde3139..a20071859 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -96,7 +96,7 @@ void cmVariableWatch::RemoveWatch(const std::string& variable, } } -void cmVariableWatch::VariableAccessed(const std::string& variable, +bool cmVariableWatch::VariableAccessed(const std::string& variable, int access_type, const char* newValue, const cmMakefile* mf) const @@ -112,5 +112,7 @@ void cmVariableWatch::VariableAccessed(const std::string& variable, (*it)->Method(variable, access_type, (*it)->ClientData, newValue, mf); } + return true; } + return false; } diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 0ca4a5580..2f082afe2 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -42,7 +42,7 @@ public: /** * This method is called when variable is accessed */ - void VariableAccessed(const std::string& variable, int access_type, + bool VariableAccessed(const std::string& variable, int access_type, const char* newValue, const cmMakefile* mf) const; /** diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake index 8d8d00099..d0046caa1 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake @@ -1,14 +1,15 @@ +cmake_minimum_required(VERSION 3.3) + find_package(PkgConfig REQUIRED) pkg_check_modules(NCURSES QUIET ncurses) if (NCURSES_FOUND) foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) - get_property("${variable}" + get_property(value CACHE "NCURSES_${variable}" - PROPERTY TYPE - SET) - if (NOT ${variable}) - message(FATAL_ERROR "Failed to set cache entry for NCURSES_${variable}") + PROPERTY VALUE) + if (NOT value STREQUAL NCURSES_${variable}) + message(FATAL_ERROR "Failed to set cache entry for NCURSES_${variable}:\nexpected -->${value}<--\nreceived -->${NCURSES_${variable}}<--") endif () endforeach () else () diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 395c74b30..b77d5d40e 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -97,6 +97,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7) endif() if(NOT XCODE_VERSION VERSION_LESS 6) + # XcodeIOSInstallCombined set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS @@ -114,6 +115,7 @@ if(NOT XCODE_VERSION VERSION_LESS 6) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_OPTIONS) + # XcodeIOSInstallCombinedPrune set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS @@ -130,4 +132,22 @@ if(NOT XCODE_VERSION VERSION_LESS 6) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_OPTIONS) + + # XcodeIOSInstallCombinedSingleArch + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "-DCMAKE_IOS_INSTALL_COMBINED=YES") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombinedSingleArch) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake new file mode 100644 index 000000000..3c11ae0ee --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake @@ -0,0 +1,25 @@ +function(verify_architecture file) + execute_process( + COMMAND xcrun lipo -info ${RunCMake_TEST_BINARY_DIR}/_install/${file} + OUTPUT_VARIABLE lipo_out + ERROR_VARIABLE lipo_err + RESULT_VARIABLE lipo_result) + if(NOT lipo_result EQUAL "0") + message(SEND_ERROR "lipo -info failed: ${lipo_err}") + return() + endif() + + string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}") + string(REGEX REPLACE "is architecture: " "" actual "${architecture}") + + set(expected armv7) + + if(NOT actual STREQUAL expected) + message(SEND_ERROR + "The actual library architecture:\n ${actual} \n" + "which do not match expected ones:\n ${expected} \n" + "lipo output:\n${lipo_out}") + endif() +endfunction() + +verify_architecture(lib/libfoo.dylib) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake new file mode 100644 index 000000000..4b5e7ce36 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.3) + +project(XcodeIOSInstallCombinedSingleArch CXX) + +set(CMAKE_OSX_SYSROOT iphoneos) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") + +add_library(foo SHARED foo.cpp) +install(TARGETS foo DESTINATION lib) + +set_target_properties( + foo + PROPERTIES + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "" + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "" +)