diff options
21 files changed, 280 insertions, 25 deletions
diff --git a/Help/release/dev/update-osx-release.rst b/Help/release/dev/update-osx-release.rst new file mode 100644 index 0000000..7634c05 --- /dev/null +++ b/Help/release/dev/update-osx-release.rst @@ -0,0 +1,5 @@ +update-osx-release +------------------ + +* The precompiled OS X binary provided on ``cmake.org`` now requires + OS X 10.7 or newer. diff --git a/Help/release/dev/vs-clang-cl.rst b/Help/release/dev/vs-clang-cl.rst new file mode 100644 index 0000000..ac09188 --- /dev/null +++ b/Help/release/dev/vs-clang-cl.rst @@ -0,0 +1,5 @@ +vs-clang-cl +----------- + +* The :generator:`Visual Studio 14 2015` generator learned to support the + Clang/C2 toolsets, e.g. with the ``-T v140_clang_3_7`` option. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index feae1c4..fbfd7a9 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -157,7 +157,11 @@ Id flags: ${testflags} set(vs_version ${CMAKE_MATCH_1}) set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") - set(id_cl cl.exe) + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + set(id_cl clang.exe) + else() + set(id_cl cl.exe) + endif() if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") set(v NsightTegra) set(ext vcxproj) diff --git a/Modules/Compiler/Clang-CXX-TestableFeatures.cmake b/Modules/Compiler/Clang-CXX-TestableFeatures.cmake index b39475c..69965a6 100644 --- a/Modules/Compiler/Clang-CXX-TestableFeatures.cmake +++ b/Modules/Compiler/Clang-CXX-TestableFeatures.cmake @@ -8,7 +8,6 @@ set(testable_features cxx_constexpr cxx_contextual_conversions cxx_decltype - cxx_decltype_incomplete_return_types cxx_default_function_template_args cxx_defaulted_functions cxx_delegating_constructors @@ -36,6 +35,9 @@ set(testable_features cxx_variable_templates cxx_variadic_templates ) +if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + list(APPEND testable_features cxx_decltype_incomplete_return_types) +endif() foreach(feature ${testable_features}) set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})") diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 135038c..8fe8f7a 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -92,10 +92,14 @@ macro(java_append_library_directories _var) if(_path MATCHES "{libarch}") foreach(_libarch ${_java_libarch}) string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") - list(APPEND ${_var} "${_newpath}") + if(EXISTS ${_newpath}) + list(APPEND ${_var} "${_newpath}") + endif() endforeach() else() - list(APPEND ${_var} "${_path}") + if(EXISTS ${_path}) + list(APPEND ${_var} "${_path}") + endif() endif() endforeach() endmacro() @@ -147,6 +151,9 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora + /usr/lib/jvm/java-8-openjdk-{libarch}/lib/{libarch} # ubuntu 15.10 + /usr/lib/jvm/java-7-openjdk-{libarch}/lib/{libarch} # ubuntu 15.10 + /usr/lib/jvm/java-6-openjdk-{libarch}/lib/{libarch} # ubuntu 15.10 # Debian specific paths for default JVM /usr/lib/jvm/default-java/jre/lib/{libarch} /usr/lib/jvm/default-java/jre/lib @@ -181,6 +188,9 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" +) + +JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES /usr/include /usr/local/include /usr/lib/java/include @@ -190,6 +200,9 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES /usr/lib/jvm/java-1.5.0-sun/include /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex /usr/lib/jvm/java-6-openjdk/include + /usr/lib/jvm/java-8-openjdk-{libarch}/include # ubuntu 15.10 + /usr/lib/jvm/java-7-openjdk-{libarch}/include # ubuntu 15.10 + /usr/lib/jvm/java-6-openjdk-{libarch}/include # ubuntu 15.10 /usr/local/share/java/include /usr/lib/j2sdk1.4-sun/include /usr/lib/j2sdk1.5-sun/include diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake index 4cded47..61a5e0c 100644 --- a/Modules/Platform/Darwin-Clang.cmake +++ b/Modules/Platform/Darwin-Clang.cmake @@ -24,7 +24,7 @@ macro(__darwin_compiler_clang lang) set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1) + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.2) set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") endif() endmacro() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index a61413a..528cde3 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -194,8 +194,14 @@ else() if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") elseif(MSVC_VERSION GREATER 1310) - set(_RTC1 "/RTC1") - set(_FLAGS_CXX " /GR /EHsc") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + # Clang/C2 in MSVC14 Update 1 seems to not support -fsantinize (yet?) + # set(_RTC1 "-fsantinize=memory,safe-stack") + set(_FLAGS_CXX " -frtti -fexceptions") + else() + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + endif() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") else() set(_RTC1 "/GZ") @@ -296,11 +302,21 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") - set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + # note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow to compile many projects + # that include MS's own headers. CMake itself is affected project too. + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -Os -D NDEBUG") + else() + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) set(CMAKE_NINJA_DEPTYPE_${lang} msvc) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b65f25d..b60c3b3 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 20160309) +set(CMake_VERSION_PATCH 20160310) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ef18729..7c85281 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -593,19 +593,28 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( cmGeneratedFileStream makefileStream (this->CurrentReRunCMakeMakefile.c_str()); makefileStream.SetCopyIfDifferent(true); - makefileStream << "# Generated by CMake, DO NOT EDIT\n"; - std::string checkCache = root->GetBinaryDirectory(); - checkCache += "/"; - checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); - checkCache += "cmake.check_cache"; - makefileStream << this->ConvertToRelativeForMake(checkCache.c_str()) - << ": "; + makefileStream << "# Generated by CMake, DO NOT EDIT\n\n"; + + makefileStream << "empty:= \n"; + makefileStream << "space:= $(empty) $(empty)\n"; + makefileStream << "spaceplus:= $(empty)\\ $(empty)\n\n"; + for(std::vector<std::string>::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { - makefileStream << "\\\n" << this->ConvertToRelativeForMake(i->c_str()); + makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard " + << this->ConvertToRelativeForMake(i->c_str()) + << "))\n"; } - makefileStream << "\n\t" << + + std::string checkCache = root->GetBinaryDirectory(); + checkCache += "/"; + checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); + checkCache += "cmake.check_cache"; + + makefileStream << "\n" << this->ConvertToRelativeForMake(checkCache.c_str()) + << ": $(TARGETS)\n"; + makefileStream << "\t" << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand().c_str()) << " -H" << this->ConvertToRelativeForMake( root->GetSourceDirectory()) diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h index 422f47b..173f624 100644 --- a/Source/cmVS14CLFlagTable.h +++ b/Source/cmVS14CLFlagTable.h @@ -28,6 +28,8 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = "Custom", "Custom", 0}, {"Optimization", "Od", "Disabled", "Disabled", 0}, + {"Optimization", "Os", + "Minimize Size", "MinSize", 0}, {"Optimization", "O1", "Minimize Size", "MinSpace", 0}, {"Optimization", "O2", @@ -172,6 +174,24 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = {"CompileAsManaged", "clr:oldSyntax", "Common Language RunTime Support, Old Syntax", "OldSyntax", 0}, + {"CppLanguageStandard", "", + "Default", "Default", 0}, + {"CppLanguageStandard", "std=c++98", + "C++03", "c++98", 0}, + {"CppLanguageStandard", "std=c++11", + "C++11", "c++11", 0}, + {"CppLanguageStandard", "std=c++1y", + "C++14", "c++1y", 0 }, + {"CppLanguageStandard", "std=c++14", + "C++14", "c++1y", 0 }, + {"CppLanguageStandard", "std=gnu++98", + "C++03 (GNU Dialect)", "gnu++98", 0}, + {"CppLanguageStandard", "std=gnu++11", + "C++11 (GNU Dialect)", "gnu++11", 0}, + {"CppLanguageStandard", "std=gnu++1y", + "C++14 (GNU Dialect)", "gnu++1y", 0}, + {"CppLanguageStandard", "std=gnu++14", + "C++14 (GNU Dialect)", "gnu++1y", 0}, //Bool Properties {"CompileAsWinRT", "ZW", "", "true", 0}, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 27a01a3..31873b5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2078,7 +2078,18 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( if(this->MSTools) { - this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3); + cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*"); + const char* toolset = this->GlobalGenerator->GetPlatformToolset(); + if (toolset && clangToolset.find(toolset)) + { + this->WriteString("<ObjectFileName>" + "$(IntDir)%(filename).obj" + "</ObjectFileName>\n", 3); + } + else + { + this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3); + } // If not in debug mode, write the DebugInformationFormat field // without value so PDBs don't get generated uselessly. diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index e1d8966..47ccbdc 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.11) +cmake_policy(SET CMP0054 NEW) project(AliasTarget) set(CMAKE_CXX_STANDARD 98) @@ -10,6 +11,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + add_library(foo SHARED empty.cpp) add_library(PREFIX::Foo ALIAS foo) add_library(Another::Alias ALIAS foo) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c7d2138..a4b8757 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1744,7 +1744,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(MSVC) ADD_TEST_MACRO(ForceInclude foo) ADD_TEST_MACRO(PDBDirectoryAndName myexe) - ADD_TEST_MACRO(PrecompiledHeader foo) + if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_TEST_MACRO(PrecompiledHeader foo) + endif() endif() if(MSVC OR "${CMAKE_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 9251ff3..83ca7f4 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -2,6 +2,7 @@ # A more complex test case # cmake_minimum_required(VERSION 2.4) +cmake_policy(SET CMP0054 NEW) project (Complex) # Test that renaming a built-in works when configured multiple times. @@ -438,6 +439,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + # # Create the libs and the main exe # diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 3b73e70..2d92809 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -2,6 +2,7 @@ # A more complex test case # cmake_minimum_required(VERSION 2.4) +cmake_policy(SET CMP0054 NEW) project (Complex) # Try setting a new policy. The IF test is for coverage. @@ -401,6 +402,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + # # Create the libs and the main exe # diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 7fce330..8b94ca7 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) +cmake_policy(SET CMP0054 NEW) project(GenerateExportHeader) @@ -66,6 +67,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + add_subdirectory(lib_shared_and_static) add_compiler_export_flags() @@ -107,7 +114,10 @@ add_executable(GenerateExportHeader exportheader_test.cpp) target_link_libraries(GenerateExportHeader ${link_libraries}) if (WIN32 OR CYGWIN) - if(MSVC AND COMPILER_HAS_DEPRECATED) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(_platform Win32-Clang) + elseif(MSVC AND COMPILER_HAS_DEPRECATED) set(_platform Win32) elseif((MINGW OR CYGWIN) AND COMPILER_HAS_DEPRECATED) set(_platform MinGW) diff --git a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h new file mode 100644 index 0000000..d376631 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -0,0 +1,41 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __declspec(dllexport) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __declspec(dllimport) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -0,0 +1,41 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 180f9fe..5fd69ef 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8) +cmake_policy(SET CMP0054 NEW) project(PDBDirectoryAndName C) # Make sure the proper compiler is in use. @@ -62,6 +63,14 @@ list(APPEND my_targets myexe2) target_link_libraries(myexe2 mylibA mylibD) + +# Clang/C2 does not produce pdb files for static libraries +if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND + CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + list(REMOVE_ITEM my_targets mylibB mylibD) +endif() + + #----------------------------------------------------------------------------- # Check that PDB files actually appear where expected. diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index 2b7bac1..49ff317 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required (VERSION 2.6) +cmake_policy(SET CMP0054 NEW) project(Plugin) # Test per-target output directory properties. @@ -34,6 +35,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + # Create an executable that exports an API for use by plugins. add_executable(example_exe src/example_exe.cxx) set_target_properties(example_exe PROPERTIES diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 31c72fb..51e0b0a 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -40,3 +40,42 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode") endif() run_BuildDepends(Custom-Always) + +function(run_ReGeneration) + # test re-generation of project even if CMakeLists.txt files disappeared + + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/regenerate-project-build) + set(RunCMake_TEST_SOURCE_DIR ${RunCMake_BINARY_DIR}/regenerate-project-source) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + set(ProjectHeader [=[ + cmake_minimum_required(VERSION 3.5) + project(Regenerate-Project NONE) + ]=]) + + # create project with subdirectory + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" "${ProjectHeader}" + "add_subdirectory(mysubdir)") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}/mysubdir") + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/mysubdir/CMakeLists.txt" "# empty") + + run_cmake(Regenerate-Project) + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}) + + # now we delete the subdirectory and adjust the CMakeLists.txt + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}/mysubdir") + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" "${ProjectHeader}") + + run_cmake_command(Regenerate-Project-Directory-Removed + ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}") + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + +if(RunCMake_GENERATOR STREQUAL "Xcode") + run_ReGeneration(regenerate-project) +endif() |