diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/AliasTarget/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h | 41 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h | 41 | ||||
-rw-r--r-- | Tests/PDBDirectoryAndName/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/Plugin/CMakeLists.txt | 7 |
9 files changed, 133 insertions, 2 deletions
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 |