diff options
23 files changed, 84 insertions, 26 deletions
diff --git a/Copyright.txt b/Copyright.txt index daaa1d1..3320108 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -68,6 +68,7 @@ The following individuals and institutions are among the Contributors: * Matthaeus G. Chajdas * Matthias Kretz <kretz@kde.org> * Matthias Maennich <matthias@maennich.net> +* Michael Stürmer * Miguel A. Figueroa-Villanueva * Mike Jackson * Mike McQuaid <mike@mikemcquaid.com> diff --git a/Help/release/3.9.rst b/Help/release/3.9.rst index 5087b43..897e268 100644 --- a/Help/release/3.9.rst +++ b/Help/release/3.9.rst @@ -34,8 +34,6 @@ Generators This is an experimental feature and can be activated by setting the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable to a ``TRUE`` value. -* The :generator:`Xcode` generator now supports Xcode 9. - Commands -------- @@ -337,3 +335,8 @@ Changes made since CMake 3.9.0 include the following. * On macOS, the default application bundle ``Info.plist`` file no longer enables Hi-DPI support as it did in 3.9.0 and 3.9.1. The change had to be reverted because it broke iOS applications. + +* The Xcode generator no longer adds "outputPaths" to custom script + build phases as it did in 3.9.0 and 3.9.1. This was added in an + attempt to support Xcode 9's new build system, but broke incremental + rebuilds for both the old and new Xcode build systems. diff --git a/Modules/CMakeCSharpInformation.cmake b/Modules/CMakeCSharpInformation.cmake index cd86016..f71dcef 100644 --- a/Modules/CMakeCSharpInformation.cmake +++ b/Modules/CMakeCSharpInformation.cmake @@ -43,7 +43,7 @@ endif() # on the initial values computed in the platform/*.cmake files # use _INIT variables so that this only happens the first time # and you can set these flags in the cmake cache -set(CMAKE_CSharp_FLAGS_INIT "$ENV{CSharpFLAGS} ${CMAKE_CSharp_FLAGS_INIT}") +set(CMAKE_CSharp_FLAGS_INIT "$ENV{CSFLAGS} ${CMAKE_CSharp_FLAGS_INIT}") # avoid just having a space as the initial value for the cache if(CMAKE_CSharp_FLAGS_INIT STREQUAL " ") set(CMAKE_CSharp_FLAGS_INIT) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index eeb806f..7588f63 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -706,6 +706,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags) OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res + ENCODING AUTO # cl prints in current code page ) if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n]*:[^:\n]*:[ \t]*)") set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index b4abf75..b970e2b 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -208,10 +208,6 @@ # # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. -# Save project's policies -cmake_policy(PUSH) -cmake_policy(SET CMP0057 NEW) # if IN_LIST - #------------------------------------------------------------------------------- # Before we go searching, check whether boost-cmake is available, unless the # user specifically asked NOT to search for boost-cmake. @@ -876,7 +872,9 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar) set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) - if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components)) + list(FIND _boost_processed_components "${componentdep}" _boost_component_found) + list(FIND _boost_new_components "${componentdep}" _boost_component_new) + if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1) list(APPEND _boost_new_components ${componentdep}) endif() endforeach() @@ -1503,7 +1501,8 @@ endif() _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) # If thread is required, get the thread libs as a dependency -if("thread" IN_LIST Boost_FIND_COMPONENTS) +list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) +if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) include(CMakeFindDependencyMacro) find_dependency(Threads) endif() @@ -1928,6 +1927,3 @@ list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) list(SORT _Boost_COMPONENTS_SEARCHED) set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" CACHE INTERNAL "Components requested for this build tree.") - -# Restore project's policies -cmake_policy(POP) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 1093be0..ee74a1a 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -429,6 +429,8 @@ foreach(LANG IN ITEMS C CXX Fortran) endif() endforeach() +set(OpenMP_FOUND ${OPENMP_FOUND}) + if(CMAKE_Fortran_COMPILER_LOADED AND OpenMP_Fortran_FOUND) if(NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE) set(OpenMP_Fortran_HAVE_OMPLIB_MODULE FALSE CACHE BOOL INTERNAL "") diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake index d983dd6..0649925 100644 --- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake +++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake @@ -124,7 +124,7 @@ file(STRINGS "${_ANDROID_TOOL_SETUP_MK}" _ANDROID_TOOL_SETUP REGEX "^(LLVM|TOOLC unset(_ANDROID_TOOL_SETUP_MK) set(_ANDROID_TOOL_PREFIX "") set(_ANDROID_TOOL_NAME_ONLY "") -set(_ANDROID_TOOL_LLVM_NAME "") +set(_ANDROID_TOOL_LLVM_NAME "llvm") set(_ANDROID_TOOL_LLVM_VERS "") foreach(line IN LISTS _ANDROID_TOOL_SETUP) if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 9864cf3..d26d5bc 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -9,6 +9,7 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" +#include <algorithm> #include <iomanip> #include <map> #include <stdlib.h> diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 329c7a9..c9924f6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -158,7 +158,7 @@ const char* cmGeneratorTarget::GetSourcesProperty() const } static std::string value; value.clear(); - value = cmJoin(values, ""); + value = cmJoin(values, ";"); return value.c_str(); } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 87a22d1..bbff48e 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -778,6 +778,19 @@ bool cmGlobalVisualStudioGenerator::TargetIsCSharpOnly( return false; } +bool cmGlobalVisualStudioGenerator::TargetCanBeReferenced( + cmGeneratorTarget const* gt) +{ + if (this->TargetIsCSharpOnly(gt)) { + return true; + } + if (gt->GetType() != cmStateEnums::SHARED_LIBRARY && + gt->GetType() != cmStateEnums::EXECUTABLE) { + return false; + } + return true; +} + bool cmGlobalVisualStudioGenerator::TargetCompare::operator()( cmGeneratorTarget const* l, cmGeneratorTarget const* r) const { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index c12a933..3c43ccd 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -85,6 +85,9 @@ public: // return true if target is C# only static bool TargetIsCSharpOnly(cmGeneratorTarget const* gt); + // return true if target can be referenced by C# targets + bool TargetCanBeReferenced(cmGeneratorTarget const* gt); + /** Get the top-level registry key for this VS version. */ std::string GetRegistryBase(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3cd14e1..9037961 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1517,17 +1517,6 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase( makecmd += " all"; buildphase->AddAttribute("shellScript", this->CreateString(makecmd)); buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); - - cmXCodeObject* outputFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (std::vector<cmCustomCommand>::const_iterator i = commands.begin(); - i != commands.end(); ++i) { - std::vector<std::string> const& outputs = i->GetOutputs(); - for (std::vector<std::string>::const_iterator j = outputs.begin(); - j != outputs.end(); ++j) { - outputFiles->AddObject(this->CreateString(*j)); - } - } - buildphase->AddAttribute("outputPaths", outputFiles); } void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 88fa19c..dee153f 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3502,6 +3502,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() (*this->BuildFileStream) << "</Project>\n"; this->WriteString("<Name>", 3); (*this->BuildFileStream) << name << "</Name>\n"; + if (csproj == this->ProjectType) { + if (!static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) + ->TargetCanBeReferenced(dt)) { + this->WriteString( + "<ReferenceOutputAssembly>false</ReferenceOutputAssembly>\n", 3); + } + } this->WriteString("</ProjectReference>\n", 2); } this->WriteString("</ItemGroup>\n", 1); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index c5a6836..da1fe6d 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -306,7 +306,7 @@ int do_cmake(int ac, char const* const* av) return ret; } cmake::Role const role = - workingMode == cmake::NORMAL_MODE ? cmake::RoleProject : cmake::RoleScript; + workingMode == cmake::SCRIPT_MODE ? cmake::RoleScript : cmake::RoleProject; cmake cm(role); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); diff --git a/Tests/CSharpLinkToCxx/CMakeLists.txt b/Tests/CSharpLinkToCxx/CMakeLists.txt index c4269e0..153c57c 100644 --- a/Tests/CSharpLinkToCxx/CMakeLists.txt +++ b/Tests/CSharpLinkToCxx/CMakeLists.txt @@ -15,3 +15,9 @@ target_compile_options(CLIApp PRIVATE "/clr") add_executable(CSharpLinkToCxx csharp.cs) target_link_libraries(CSharpLinkToCxx CLIApp) + +# this unmanaged C++ library will be added to the C#/.NET +# references of CSharpLinkToCxx but it will show a warning +# because it is unmanaged +add_library(CppNativeApp SHARED cpp_native.hpp cpp_native.cpp) +target_link_libraries(CSharpLinkToCxx CppNativeApp) diff --git a/Tests/CSharpLinkToCxx/cpp_native.cpp b/Tests/CSharpLinkToCxx/cpp_native.cpp new file mode 100644 index 0000000..dc7670f --- /dev/null +++ b/Tests/CSharpLinkToCxx/cpp_native.cpp @@ -0,0 +1,10 @@ +#include "cpp_native.hpp" + +#include <iostream> + +namespace CppApp { +void MyCpp::testMyCpp() +{ + std::cout << "#message from CppApp" << std::endl; +} +} diff --git a/Tests/CSharpLinkToCxx/cpp_native.hpp b/Tests/CSharpLinkToCxx/cpp_native.hpp new file mode 100644 index 0000000..0fa1a3b --- /dev/null +++ b/Tests/CSharpLinkToCxx/cpp_native.hpp @@ -0,0 +1,9 @@ +#pragma once + +namespace CppApp { +class MyCpp +{ +public: + void testMyCpp(); +}; +} diff --git a/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in b/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in index dc62bac..2eb7b7a 100644 --- a/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in +++ b/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in @@ -5,5 +5,7 @@ find_path(FOO_INCLUDE_DIR NAMES foo.h HINTS "@CMAKE_CURRENT_SOURCE_DIR@" ) set(FOO_LIBRARIES ${FOO_LIBRARY}) set(FOO_INCLUDE_DIRS "${FOO_INCLUDE_DIR}" "/some/path/with a space/include" ) +add_library(Foo::Foo INTERFACE IMPORTED) + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Foo DEFAULT_MSG FOO_LIBRARY FOO_INCLUDE_DIR ) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 63cd2da..2486259 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -32,6 +32,7 @@ run_cmake(COMPILE_LANGUAGE-unknown-lang) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) run_cmake(TARGET_PROPERTY-LOCATION) +run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake new file mode 100644 index 0000000..f1452b5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake @@ -0,0 +1,9 @@ +file(READ ${RunCMake_TEST_BINARY_DIR}/foo.txt foo_sources) + +# VS generators inject CMakeLists.txt as a source. Remove it. +string(REGEX REPLACE ";[^;]*CMakeLists.txt$" "" foo_sources "${foo_sources}") + +set(foo_expected "empty.c;empty2.c;empty3.c") +if(NOT foo_sources STREQUAL foo_expected) + set(RunCMake_TEST_FAILED "foo SOURCES was:\n [[${foo_sources}]]\nbut expected:\n [[${foo_expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake new file mode 100644 index 0000000..dee7ead --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0070 NEW) +enable_language(C) +add_library(foo empty.c empty2.c) +target_sources(foo PRIVATE empty3.c) +file(GENERATE OUTPUT foo.txt CONTENT "$<TARGET_PROPERTY:foo,SOURCES>") diff --git a/Tests/RunCMake/GeneratorExpression/empty2.c b/Tests/RunCMake/GeneratorExpression/empty2.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty2.c diff --git a/Tests/RunCMake/GeneratorExpression/empty3.c b/Tests/RunCMake/GeneratorExpression/empty3.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty3.c |