summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/get_test_property.rst8
-rw-r--r--Help/command/if.rst9
-rw-r--r--Help/command/set_tests_properties.rst2
-rw-r--r--Help/prop_tgt/CXX_STANDARD.rst2
-rw-r--r--Help/release/dev/feature_record_msvc.rst6
-rw-r--r--Modules/Compiler/MSVC-C-FeatureTests.cmake23
-rw-r--r--Modules/Compiler/MSVC-CXX-FeatureTests.cmake97
-rw-r--r--Modules/FindCUDA.cmake10
-rw-r--r--Modules/Platform/Linux-XL-C.cmake1
-rw-r--r--Modules/Platform/Linux-XL-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-XL-Fortran.cmake1
-rw-r--r--Modules/Platform/Windows-MSVC-C.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC-CXX.cmake9
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx5
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt56
-rw-r--r--Tests/CompileFeatures/genex_test.cpp15
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt14
-rw-r--r--Tests/Complex/Executable/complex.cxx22
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt14
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx22
-rw-r--r--Tests/CustomCommand/CMakeLists.txt7
-rw-r--r--Tests/CustomCommand/config.h.in1
-rw-r--r--Tests/CustomCommand/foo.in3
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt30
-rw-r--r--Tests/OutDir/OutDir.cmake10
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake4
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake2
-rw-r--r--Tests/RunCMake/get_property/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/get_property/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/get_property/cache_properties-stderr.txt3
-rw-r--r--Tests/RunCMake/get_property/cache_properties.cmake15
-rw-r--r--Tests/RunCMake/get_property/directory_properties-stderr.txt6
-rw-r--r--Tests/RunCMake/get_property/directory_properties.cmake15
-rw-r--r--Tests/RunCMake/get_property/global_properties-stderr.txt6
-rw-r--r--Tests/RunCMake/get_property/global_properties.cmake16
-rw-r--r--Tests/RunCMake/get_property/install_properties-stderr.txt3
-rw-r--r--Tests/RunCMake/get_property/install_properties.cmake18
-rw-r--r--Tests/RunCMake/get_property/source_properties-stderr.txt6
-rw-r--r--Tests/RunCMake/get_property/source_properties.cmake15
-rw-r--r--Tests/RunCMake/get_property/target_properties-stderr.txt6
-rw-r--r--Tests/RunCMake/get_property/target_properties.cmake16
-rw-r--r--Tests/RunCMake/get_property/test_properties-stderr.txt6
-rw-r--r--Tests/RunCMake/get_property/test_properties.cmake17
49 files changed, 478 insertions, 85 deletions
diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst
index 2623755..391a32e 100644
--- a/Help/command/get_test_property.rst
+++ b/Help/command/get_test_property.rst
@@ -7,9 +7,9 @@ Get a property of the test.
get_test_property(test property VAR)
-Get a property from the Test. The value of the property is stored in
-the variable VAR. If the property is not found, VAR will be set to
-"NOTFOUND". For a list of standard properties you can type cmake
---help-property-list
+Get a property from the test. The value of the property is stored in
+the variable VAR. If the test or property is not found, VAR will be
+set to "NOTFOUND". For a list of standard properties you can type cmake
+--help-property-list.
See also the more general get_property() command.
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 79e5d21..d50b14c 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -42,11 +42,12 @@ Possible expressions are:
or a non-zero number. False if the constant is ``0``, ``OFF``,
``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string,
or ends in the suffix ``-NOTFOUND``. Named boolean constants are
- case-insensitive. If the argument is not one of these constants, it
- is treated as a variable.
+ case-insensitive. If the argument is not one of these specific
+ constants, it is treated as a variable or string and the following
+ signature is used.
-``if(<variable>)``
- True if the variable is defined to a value that is not a false
+``if(<variable|string>)``
+ True if given a variable that is defined to a value that is not a false
constant. False otherwise. (Note macro arguments are not variables.)
``if(NOT <expression>)``
diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst
index e29d690..afac847 100644
--- a/Help/command/set_tests_properties.rst
+++ b/Help/command/set_tests_properties.rst
@@ -7,7 +7,7 @@ Set a property of the tests.
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
-Set a property for the tests. If the property is not found, CMake
+Set a property for the tests. If the test is not found, CMake
will report an error. Generator expressions will be expanded the same
as supported by the test's add_test call. The properties include:
diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst
index b50cdf9..6329e34 100644
--- a/Help/prop_tgt/CXX_STANDARD.rst
+++ b/Help/prop_tgt/CXX_STANDARD.rst
@@ -7,7 +7,7 @@ This property specifies the C++ standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu++11`` to the compile line.
-Supported values are ``98`` and ``11``.
+Supported values are ``98``, ``11`` and ``14``.
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/release/dev/feature_record_msvc.rst b/Help/release/dev/feature_record_msvc.rst
new file mode 100644
index 0000000..63b642d
--- /dev/null
+++ b/Help/release/dev/feature_record_msvc.rst
@@ -0,0 +1,6 @@
+feature_record_msvc
+-------------------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ is now aware of features supported by Visual Studio 2010 and above
+ (``MSVC``).
diff --git a/Modules/Compiler/MSVC-C-FeatureTests.cmake b/Modules/Compiler/MSVC-C-FeatureTests.cmake
new file mode 100644
index 0000000..e449358
--- /dev/null
+++ b/Modules/Compiler/MSVC-C-FeatureTests.cmake
@@ -0,0 +1,23 @@
+
+# Reference: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+# http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx
+
+set(_cmake_oldestSupported "_MSC_VER >= 1300")
+
+set(MSVC_2010 "_MSC_VER >= 1600")
+set(_cmake_feature_test_c_static_assert "${MSVC_2010}")
+set(_cmake_feature_test_c_variadic_macros "${MSVC_2010}")
+
+set(MSVC_2003 "_MSC_VER >= 1300")
+set(_cmake_feature_test_c_function_prototypes "${MSVC_2003}")
+
+# Currently unsupported:
+# restrict requires the __restrict syntax in msvc
+# set(_cmake_feature_test_c_restrict)
+
+# Unset all the variables that we don't need exposed.
+# _cmake_oldestSupported is required by WriteCompilerDetectionHeader
+set(MSVC_2010)
+set(MSVC_2003) \ No newline at end of file
diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
new file mode 100644
index 0000000..b238fde
--- /dev/null
+++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
@@ -0,0 +1,97 @@
+
+# Reference: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+# http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx
+
+
+set(_cmake_oldestSupported "_MSC_VER >= 1600")
+
+set(MSVC_2015 "_MSC_VER >= 1900")
+set(_cmake_feature_test_cxx_alignas "${MSVC_2015}")
+set(_cmake_feature_test_cxx_alignof "${MSVC_2015}")
+set(_cmake_feature_test_cxx_binary_literals "${MSVC_2015}")
+set(_cmake_feature_test_cxx_decltype_auto "${MSVC_2015}")
+set(_cmake_feature_test_cxx_digit_separators "${MSVC_2015}")
+set(_cmake_feature_test_cxx_func_identifier "${MSVC_2015}")
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+# Note 1. While previous version of VisualStudio said they supported this
+# they silently produced bad code, and are now marked as having partial
+# support
+set(_cmake_feature_test_cxx_generalized_initializers "${MSVC_2015}")
+set(_cmake_feature_test_cxx_generic_lambdas "${MSVC_2015}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${MSVC_2015}")
+set(_cmake_feature_test_cxx_inline_namespaces "${MSVC_2015}")
+set(_cmake_feature_test_cxx_lambda_init_captures "${MSVC_2015}")
+set(_cmake_feature_test_cxx_noexcept "${MSVC_2015}")
+set(_cmake_feature_test_cxx_return_type_deduction "${MSVC_2015}")
+set(_cmake_feature_test_cxx_sizeof_member "${MSVC_2015}")
+set(_cmake_feature_test_cxx_thread_local "${MSVC_2015}")
+set(_cmake_feature_test_cxx_unicode_literals "${MSVC_2015}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${MSVC_2015}")
+set(_cmake_feature_test_cxx_user_literals "${MSVC_2015}")
+
+set(MSVC_2013 "_MSC_VER >= 1800")
+set(_cmake_feature_test_cxx_alias_templates "${MSVC_2013}")
+set(_cmake_feature_test_cxx_default_function_template_args "${MSVC_2013}")
+set(_cmake_feature_test_cxx_defaulted_functions "${MSVC_2013}")
+set(_cmake_feature_test_cxx_delegating_constructors "${MSVC_2013}")
+set(_cmake_feature_test_cxx_deleted_functions "${MSVC_2013}")
+set(_cmake_feature_test_cxx_explicit_conversions "${MSVC_2013}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${MSVC_2013}")
+set(_cmake_feature_test_cxx_raw_string_literals "${MSVC_2013}")
+set(_cmake_feature_test_cxx_uniform_initialization "${MSVC_2013}")
+# Possibly broken:
+# http://thread.gmane.org/gmane.comp.lib.boost.devel/244986/focus=245333
+set(_cmake_feature_test_cxx_variadic_templates "${MSVC_2013}")
+# Microsoft now states they support contextual conversions
+# see footnote 6 at:
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+set(_cmake_feature_test_cxx_contextual_conversions "${MSVC_2013}")
+
+set(MSVC_2012 "_MSC_VER >= 1700")
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${MSVC_2012}")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${MSVC_2012}")
+set(_cmake_feature_test_cxx_final "${MSVC_2012}")
+set(_cmake_feature_test_cxx_range_for "${MSVC_2012}")
+set(_cmake_feature_test_cxx_strong_enums "${MSVC_2012}")
+
+set(MSVC_2010 "_MSC_VER >= 1600")
+set(_cmake_feature_test_cxx_auto_function "${MSVC_2010}")
+set(_cmake_feature_test_cxx_auto_type "${MSVC_2010}")
+set(_cmake_feature_test_cxx_decltype "${MSVC_2010}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${MSVC_2010}")
+set(_cmake_feature_test_cxx_extern_templates "${MSVC_2010}")
+set(_cmake_feature_test_cxx_lambdas "${MSVC_2010}")
+set(_cmake_feature_test_cxx_local_type_template_args "${MSVC_2010}")
+set(_cmake_feature_test_cxx_long_long_type "${MSVC_2010}")
+set(_cmake_feature_test_cxx_nullptr "${MSVC_2010}")
+set(_cmake_feature_test_cxx_override "${MSVC_2010}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${MSVC_2010}")
+set(_cmake_feature_test_cxx_rvalue_references "${MSVC_2010}")
+set(_cmake_feature_test_cxx_static_assert "${MSVC_2010}")
+set(_cmake_feature_test_cxx_template_template_parameters "${MSVC_2010}")
+set(_cmake_feature_test_cxx_trailing_return_types "${MSVC_2010}")
+set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}")
+
+# Currently unsupported:
+# http://herbsutter.com/2013/11/18/visual-c-compiler-november-2013-ctp/
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+
+# set(_cmake_feature_test_cxx_reference_qualified_functions )
+# set(_cmake_feature_test_cxx_constexpr )
+# set(_cmake_feature_test_cxx_attributes )
+# set(_cmake_feature_test_cxx_aggregate_default_initializers )
+# set(_cmake_feature_test_cxx_attribute_deprecated )
+# set(_cmake_feature_test_cxx_defaulted_move_initializers )
+# set(_cmake_feature_test_cxx_nonstatic_member_init )
+# set(_cmake_feature_test_cxx_relaxed_constexpr )
+# set(_cmake_feature_test_cxx_variable_templates )
+
+
+# Unset all the variables that we don't need exposed.
+# _cmake_oldestSupported is required by WriteCompilerDetectionHeader
+set(MSVC_2015)
+set(MSVC_2013)
+set(MSVC_2012)
+set(MSVC_2010)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index ecfc781..4f1f09a 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1423,7 +1423,8 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
endif()
- # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG}
+
+ # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} and CMAKE_${CUDA_C_OR_CXX}_FLAGS*
set(config_specific_flags)
set(flags)
foreach(config ${CUDA_configuration_types})
@@ -1438,6 +1439,13 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
list(APPEND flags $<$<CONFIG:${config}>:-Xcompiler> $<$<CONFIG:${config}>:${f}>)
endforeach()
endforeach()
+ # Add CMAKE_${CUDA_C_OR_CXX}_FLAGS
+ set(important_host_flags)
+ _cuda_get_important_host_flags(important_host_flags ${CMAKE_${CUDA_C_OR_CXX}_FLAGS})
+ foreach(f ${important_host_flags})
+ list(APPEND flags -Xcompiler ${f})
+ endforeach()
+
# Add our general CUDA_NVCC_FLAGS with the configuration specifig flags
set(nvcc_flags ${CUDA_NVCC_FLAGS} ${config_specific_flags} ${nvcc_flags})
diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake
index f1c584c..d595e44 100644
--- a/Modules/Platform/Linux-XL-C.cmake
+++ b/Modules/Platform/Linux-XL-C.cmake
@@ -1 +1,2 @@
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj")
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-export-dynamic")
diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake
index abd3fa4..5ceb255 100644
--- a/Modules/Platform/Linux-XL-CXX.cmake
+++ b/Modules/Platform/Linux-XL-CXX.cmake
@@ -1 +1,2 @@
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj")
+set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,-export-dynamic")
diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake
index cdd1f70..a878991 100644
--- a/Modules/Platform/Linux-XL-Fortran.cmake
+++ b/Modules/Platform/Linux-XL-Fortran.cmake
@@ -1 +1,2 @@
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj")
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-export-dynamic")
diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake
index cbe1586..c7792eb 100644
--- a/Modules/Platform/Windows-MSVC-C.cmake
+++ b/Modules/Platform/Windows-MSVC-C.cmake
@@ -3,3 +3,5 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
set(_FS_C " /FS")
endif()
__windows_compiler_msvc(C)
+
+set(CMAKE_C_STANDARD_DEFAULT 90)
diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake
index 0e85005..ad56f68 100644
--- a/Modules/Platform/Windows-MSVC-CXX.cmake
+++ b/Modules/Platform/Windows-MSVC-CXX.cmake
@@ -4,3 +4,12 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
set(_FS_CXX " /FS")
endif()
__windows_compiler_msvc(CXX)
+
+# No version of MSVC has full conformance to C++11. Therefore the
+# __cplusplus macro always evaluates to 98 even if the compilers come with
+# C++11/14/+ features enabled.
+set(CMAKE_CXX_STANDARD_DEFAULT 98)
+
+macro(cmake_record_cxx_compile_features)
+ record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
+endmacro()
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index d61358f..d4678c7 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -36,7 +36,7 @@
# PREFIX ClimbingStats
# OUTPUT_FILES_VAR support_files
# OUTPUT_DIR compilers
-# COMPILERS GNU Clang
+# COMPILERS GNU Clang MSVC
# FEATURES cxx_variadic_templates
# )
# install(FILES
@@ -100,7 +100,7 @@
# write_compiler_detection_header(
# FILE climbingstats_compiler_detection.h
# PREFIX ClimbingStats
-# COMPILERS GNU Clang AppleClang
+# COMPILERS GNU Clang AppleClang MSVC
# FEATURES cxx_variadic_templates
# )
#
@@ -317,6 +317,7 @@ function(write_compiler_detection_header
GNU
Clang
AppleClang
+ MSVC
)
set(_hex_compilers ADSP Borland Embarcadero SunPro)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8024a7d..89ccad5 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 1)
-set(CMake_VERSION_PATCH 20150109)
+set(CMake_VERSION_PATCH 20150112)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index aa6f0c1..fb59df8 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -23,6 +23,7 @@ bool cmGetTargetPropertyCommand
std::string var = args[0];
const std::string& targetName = args[1];
std::string prop;
+ bool prop_exists = false;
if(args[2] == "ALIASED_TARGET")
{
@@ -32,6 +33,7 @@ bool cmGetTargetPropertyCommand
this->Makefile->FindTargetToUse(targetName))
{
prop = target->GetName();
+ prop_exists = true;
}
}
}
@@ -42,6 +44,7 @@ bool cmGetTargetPropertyCommand
if(prop_cstr)
{
prop = prop_cstr;
+ prop_exists = true;
}
}
else
@@ -74,7 +77,7 @@ bool cmGetTargetPropertyCommand
}
}
}
- if (!prop.empty())
+ if (prop_exists)
{
this->Makefile->AddDefinition(var, prop.c_str());
return true;
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index a67a649..64f9cee 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -93,6 +93,11 @@ void cmGlobalVisualStudio71Generator
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
+#ifdef CMAKE_ENCODING_UTF8
+ // Add UTF-8 BOM for .sln file to indicate encoding
+ const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
+ fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
+#endif
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 401e475..0eb7d2c 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -558,6 +558,11 @@ void cmGlobalVisualStudio7Generator
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
+#ifdef CMAKE_ENCODING_UTF8
+ // Add UTF-8 BOM for .sln file to indicate encoding
+ const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
+ fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
+#endif
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index ff5d745..9fb8d1b 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.1)
project(CompileFeatures)
@@ -26,18 +26,31 @@ get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
foreach(feature ${c_features})
run_test(${feature} C)
endforeach()
+
get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ list(REMOVE_ITEM cxx_features
+ # This test requires auto return type deduction to work properly, but
+ # that is not supported by all versions of MSVC that support decltype
+ # incomplete return types.
+ cxx_decltype_incomplete_return_types
+ )
+endif()
+
foreach(feature ${cxx_features})
run_test(${feature} CXX)
endforeach()
-if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
+ # The cxx_alignof feature happens to work (for *this* testcase) with
+ # GNU 4.7, but it is first documented as available with GNU 4.8.
list(REMOVE_ITEM CXX_non_features
cxx_alignof
)
endif()
-if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
# GNU prior to 4.9 does not set any preprocessor define to distinguish
# c++1y from c++11, so CMake does not support c++1y features before GNU 4.9.
@@ -51,6 +64,17 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
)
endif()
+set(MSVC_)
+if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
+ MSVC_VERSION LESS 1800)
+ list(REMOVE_ITEM CXX_non_features
+ # Microsoft only officially supports this feature in VS2013 and above, due
+ # to new wording of the proposal. We don't test for this with MSVC because
+ # older compiler pass the test but might not actually conform
+ cxx_contextual_conversions
+ )
+endif()
+
set(C_ext c)
set(C_standard_flag 11)
set(CXX_ext cpp)
@@ -120,17 +144,29 @@ if (CMAKE_CXX_COMPILE_FEATURES)
add_executable(IfaceCompileFeatures main.cpp)
target_link_libraries(IfaceCompileFeatures iface)
+ add_definitions(-DEXPECT_OVERRIDE_CONTROL=1)
+
add_executable(CompileFeaturesGenex genex_test.cpp)
set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11)
- target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+
+ target_compile_definitions(CompileFeaturesGenex PRIVATE
+ HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>
+ HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr>
+ )
add_executable(CompileFeaturesGenex2 genex_test.cpp)
- target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr)
- target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+ target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_static_assert)
+ target_compile_definitions(CompileFeaturesGenex2 PRIVATE
+ HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>
+ HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr>
+ )
- add_library(noexcept_iface INTERFACE)
- target_compile_features(noexcept_iface INTERFACE cxx_noexcept)
+ add_library(static_assert_iface INTERFACE)
+ target_compile_features(static_assert_iface INTERFACE cxx_static_assert)
add_executable(CompileFeaturesGenex3 genex_test.cpp)
- target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface)
- target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+ target_link_libraries(CompileFeaturesGenex3 PRIVATE static_assert_iface)
+ target_compile_definitions(CompileFeaturesGenex3 PRIVATE
+ HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>
+ HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr>
+ )
endif()
diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp
index ca38883..4412569 100644
--- a/Tests/CompileFeatures/genex_test.cpp
+++ b/Tests/CompileFeatures/genex_test.cpp
@@ -1,6 +1,8 @@
#if !HAVE_OVERRIDE_CONTROL
+#if EXPECT_OVERRIDE_CONTROL
#error "Expect override control feature"
+#endif
#else
struct A
@@ -8,13 +10,24 @@ struct A
virtual int getA() { return 7; }
};
-struct B final : A
+struct B : A
{
int getA() override { return 42; }
};
#endif
+#if !HAVE_NULLPTR
+#error "Expect nullptr feature"
+#else
+
+const char* getString()
+{
+ return nullptr;
+}
+
+#endif
+
int main()
{
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index bf23d4a..508221c 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -89,18 +89,22 @@ remove_definitions(-DCOMPLEX_DEFINED)
# Test pre-build/pre-link/post-build rules for an executable.
add_custom_command(TARGET complex PRE_BUILD
COMMAND ${CREATE_FILE_EXE}
- ARGS "${Complex_BINARY_DIR}/Executable/prebuild.txt")
+ ARGS "Executable/prebuild.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
add_custom_command(TARGET complex PRE_LINK
COMMAND ${CREATE_FILE_EXE}
- ARGS "${Complex_BINARY_DIR}/Executable/prelink.txt")
+ ARGS "Executable/prelink.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
add_custom_command(TARGET complex POST_BUILD
COMMAND ${CREATE_FILE_EXE}
- ARGS "${Complex_BINARY_DIR}/Executable/postbuild.txt")
+ ARGS "Executable/postbuild.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
add_custom_command(TARGET complex POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
- "${Complex_BINARY_DIR}/Executable/postbuild.txt"
- "${Complex_BINARY_DIR}/Executable/postbuild2.txt")
+ "Executable/postbuild.txt"
+ "Executable/postbuild2.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
set_source_files_properties(complex
COMPILE_FLAGS
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 31442ba..ec222a5 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -716,14 +716,14 @@ int main()
// the file was removed the last time 'complex' was run, and it is
// only created during a build.
- TestAndRemoveFile(BINARY_DIR "/Library/prebuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Library/prelink.txt");
- TestAndRemoveFile(BINARY_DIR "/Library/postbuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Library/postbuild2.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/prebuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/prelink.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/postbuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/postbuild2.txt");
+ TestAndRemoveFile("Library/prebuild.txt");
+ TestAndRemoveFile("Library/prelink.txt");
+ TestAndRemoveFile("Library/postbuild.txt");
+ TestAndRemoveFile("Library/postbuild2.txt");
+ TestAndRemoveFile("Executable/prebuild.txt");
+ TestAndRemoveFile("Executable/prelink.txt");
+ TestAndRemoveFile("Executable/postbuild.txt");
+ TestAndRemoveFile("Executable/postbuild2.txt");
// ----------------------------------------------------------------------
// A custom target has been created (see Library/).
@@ -733,12 +733,12 @@ int main()
// the file was removed the last time 'complex' was run, and it is
// only created during a build.
- TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt");
+ TestAndRemoveFile("Library/custom_target1.txt");
// ----------------------------------------------------------------------
// A directory has been created.
- TestDir(BINARY_DIR "/make_dir");
+ TestDir("make_dir");
// ----------------------------------------------------------------------
// Test OUTPUT_REQUIRED_FILES
@@ -749,7 +749,7 @@ int main()
// the file was removed the last time 'complex' was run, and it is
// only created during a build.
- TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
+ TestAndRemoveFile("Executable/Temp/complex-required.txt");
// ----------------------------------------------------------------------
// Test FIND_LIBRARY
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index 01f1005..e910f20 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -89,18 +89,22 @@ remove_definitions(-DCOMPLEX_DEFINED)
# Test pre-build/pre-link/post-build rules for an executable.
add_custom_command(TARGET complex PRE_BUILD
COMMAND ${CREATE_FILE_EXE}
- ARGS "${Complex_BINARY_DIR}/Executable/prebuild.txt")
+ ARGS "Executable/prebuild.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
add_custom_command(TARGET complex PRE_BUILD
COMMAND ${CREATE_FILE_EXE}
- ARGS "${Complex_BINARY_DIR}/Executable/prelink.txt")
+ ARGS "Executable/prelink.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
add_custom_command(TARGET complex POST_BUILD
COMMAND ${CREATE_FILE_EXE}
- ARGS "${Complex_BINARY_DIR}/Executable/postbuild.txt")
+ ARGS "Executable/postbuild.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
add_custom_command(TARGET complex POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
- "${Complex_BINARY_DIR}/Executable/postbuild.txt"
- "${Complex_BINARY_DIR}/Executable/postbuild2.txt")
+ "Executable/postbuild.txt"
+ "Executable/postbuild2.txt"
+ WORKING_DIRECTORY "${Complex_BINARY_DIR}")
set_source_files_properties(complex
COMPILE_FLAGS
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 31442ba..ec222a5 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -716,14 +716,14 @@ int main()
// the file was removed the last time 'complex' was run, and it is
// only created during a build.
- TestAndRemoveFile(BINARY_DIR "/Library/prebuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Library/prelink.txt");
- TestAndRemoveFile(BINARY_DIR "/Library/postbuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Library/postbuild2.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/prebuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/prelink.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/postbuild.txt");
- TestAndRemoveFile(BINARY_DIR "/Executable/postbuild2.txt");
+ TestAndRemoveFile("Library/prebuild.txt");
+ TestAndRemoveFile("Library/prelink.txt");
+ TestAndRemoveFile("Library/postbuild.txt");
+ TestAndRemoveFile("Library/postbuild2.txt");
+ TestAndRemoveFile("Executable/prebuild.txt");
+ TestAndRemoveFile("Executable/prelink.txt");
+ TestAndRemoveFile("Executable/postbuild.txt");
+ TestAndRemoveFile("Executable/postbuild2.txt");
// ----------------------------------------------------------------------
// A custom target has been created (see Library/).
@@ -733,12 +733,12 @@ int main()
// the file was removed the last time 'complex' was run, and it is
// only created during a build.
- TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt");
+ TestAndRemoveFile("Library/custom_target1.txt");
// ----------------------------------------------------------------------
// A directory has been created.
- TestDir(BINARY_DIR "/make_dir");
+ TestDir("make_dir");
// ----------------------------------------------------------------------
// Test OUTPUT_REQUIRED_FILES
@@ -749,7 +749,7 @@ int main()
// the file was removed the last time 'complex' was run, and it is
// only created during a build.
- TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
+ TestAndRemoveFile("Executable/Temp/complex-required.txt");
// ----------------------------------------------------------------------
// Test FIND_LIBRARY
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 915da0a..57ffeec 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -164,13 +164,6 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h
${PROJECT_BINARY_DIR}/not_included.h
)
-# Tell the executable where to find not_included.h.
-configure_file(
- ${PROJECT_SOURCE_DIR}/config.h.in
- ${PROJECT_BINARY_DIR}/config.h
- @ONLY
- )
-
# add the executable
add_executable(CustomCommand
${PROJECT_BINARY_DIR}/foo.h
diff --git a/Tests/CustomCommand/config.h.in b/Tests/CustomCommand/config.h.in
deleted file mode 100644
index 86c97bd..0000000
--- a/Tests/CustomCommand/config.h.in
+++ /dev/null
@@ -1 +0,0 @@
-#define PROJECT_BINARY_DIR "@PROJECT_BINARY_DIR@"
diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in
index 0c5021c..e43aed1 100644
--- a/Tests/CustomCommand/foo.in
+++ b/Tests/CustomCommand/foo.in
@@ -1,6 +1,5 @@
#include "doc1.h"
#include "foo.h"
-#include "config.h"
#include <stdio.h>
@@ -11,7 +10,7 @@ int main ()
{
if (generated()*wrapped()*doc() == 3*5*7)
{
- FILE* fin = fopen(PROJECT_BINARY_DIR "/not_included.h", "r");
+ FILE* fin = fopen("not_included.h", "r");
if(fin)
{
fclose(fin);
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 5b2f1de..cfaa78c 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0)
+cmake_minimum_required(VERSION 3.1.0)
project(WriteCompilerDetectionHeader)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -11,7 +11,7 @@ get_property(c_known_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
write_compiler_detection_header(
FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h"
PREFIX TEST
- COMPILERS GNU Clang AppleClang
+ COMPILERS GNU Clang AppleClang MSVC
VERSION 3.1
PROLOG "// something"
EPILOG "// more"
@@ -56,17 +56,29 @@ macro(set_defines target true_defs false_defs)
)
endmacro()
-if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
- OR CMAKE_CXX_COMPILER_ID STREQUAL Clang
- OR CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# False for C++98 mode.
list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
endif()
-if (CMAKE_C_COMPILER_ID STREQUAL GNU
- OR CMAKE_C_COMPILER_ID STREQUAL Clang
- OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
+# for msvc the compiler version determines which c++11 features are available.
+# Both variadic templates and delegating constructors support exist in
+# all versions that we write compile headers for.
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
+ ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
+ list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
+ list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
+else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
+ list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
+endif()
+
+if (CMAKE_C_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_C_COMPILER_ID STREQUAL "Clang"
+ OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
add_executable(C_undefined c_undefined.c)
set_property(TARGET C_undefined PROPERTY CXX_STANDARD 90)
target_compile_options(C_undefined PRIVATE -Werror=undef)
@@ -81,7 +93,7 @@ write_compiler_detection_header(
PREFIX MULTI
OUTPUT_FILES_VAR multi_files
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support"
- COMPILERS GNU Clang AppleClang
+ COMPILERS GNU Clang AppleClang MSVC
VERSION 3.1
FEATURES
${cxx_known_features} ${c_known_features}
diff --git a/Tests/OutDir/OutDir.cmake b/Tests/OutDir/OutDir.cmake
index e1e6b7f..a1f13e7 100644
--- a/Tests/OutDir/OutDir.cmake
+++ b/Tests/OutDir/OutDir.cmake
@@ -16,13 +16,17 @@ find_program(CONLY_EXE
PATHS ${top}/runtime
NO_DEFAULT_PATH)
+file(RELATIVE_PATH TESTC1_LIB_FILE "${top}" "${TESTC1_LIB}")
+file(RELATIVE_PATH TESTC2_LIB_FILE "${top}" "${TESTC2_LIB}")
+file(RELATIVE_PATH CONLY_EXE_FILE "${top}" "${CONLY_EXE}")
+
file(WRITE ${top}/OutDir.h "/* Generated by ${CMAKE_CURRENT_LIST_FILE} */
#ifndef OutDir_h
#define OutDir_h
-#define TESTC1_LIB \"${TESTC1_LIB}\"
-#define TESTC2_LIB \"${TESTC2_LIB}\"
-#define CONLY_EXE \"${CONLY_EXE}\"
+#define TESTC1_LIB \"${TESTC1_LIB_FILE}\"
+#define TESTC2_LIB \"${TESTC2_LIB_FILE}\"
+#define CONLY_EXE \"${CONLY_EXE_FILE}\"
#endif
")
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index b5e41d9..1697025 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -121,6 +121,7 @@ add_RunCMake_test(file)
add_RunCMake_test(find_library)
add_RunCMake_test(find_package)
add_RunCMake_test(get_filename_component)
+add_RunCMake_test(get_property)
add_RunCMake_test(if)
add_RunCMake_test(include)
add_RunCMake_test(include_directories)
diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake b/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake
index c6707c1..4de8e88 100644
--- a/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake
+++ b/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake
@@ -7,11 +7,11 @@ else()
set(expected_result 0)
endif()
-add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file${HAVE_FINAL}.cpp"
+add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file${expected_result}.cpp"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp"
)
-add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp")
+add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file${expected_result}.cpp")
if (HAVE_FINAL)
target_compile_features(empty PRIVATE cxx_final)
endif()
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 1892a5c..3b37091 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -27,8 +27,13 @@ if (NOT CXX_FEATURES)
run_cmake(NoSupportedCxxFeatures)
run_cmake(NoSupportedCxxFeaturesGenex)
else()
- run_cmake(LinkImplementationFeatureCycle)
- run_cmake(LinkImplementationFeatureCycleSolved)
+ # compilers such as MSVC have no explicit flags to enable c++11 mode.
+ # Instead they come with all c++11 features implicitly enabled.
+ # So for those types of compilers this tests is not applicable.
+ if(CMAKE_CXX11_STANDARD_COMPILE_OPTION)
+ run_cmake(LinkImplementationFeatureCycle)
+ run_cmake(LinkImplementationFeatureCycleSolved)
+ endif()
if (";${CXX_FEATURES};" MATCHES ";cxx_final;")
set(RunCMake_TEST_OPTIONS "-DHAVE_FINAL=1")
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
index 748d14f..2a588bc 100644
--- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
@@ -1,4 +1,4 @@
-file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT)
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8)
list(GET TEST_TXT 0 PDB_PATH)
list(GET TEST_TXT 1 PDB_NAME)
diff --git a/Tests/RunCMake/get_property/CMakeLists.txt b/Tests/RunCMake/get_property/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/get_property/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake
new file mode 100644
index 0000000..1964824
--- /dev/null
+++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(cache_properties)
+run_cmake(directory_properties)
+run_cmake(global_properties)
+run_cmake(install_properties)
+run_cmake(source_properties)
+run_cmake(target_properties)
+run_cmake(test_properties)
diff --git a/Tests/RunCMake/get_property/cache_properties-stderr.txt b/Tests/RunCMake/get_property/cache_properties-stderr.txt
new file mode 100644
index 0000000..ee019c6
--- /dev/null
+++ b/Tests/RunCMake/get_property/cache_properties-stderr.txt
@@ -0,0 +1,3 @@
+^get_property: --><--
+get_property: -->TRUE<--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/cache_properties.cmake b/Tests/RunCMake/get_property/cache_properties.cmake
new file mode 100644
index 0000000..bf3e7ab
--- /dev/null
+++ b/Tests/RunCMake/get_property/cache_properties.cmake
@@ -0,0 +1,15 @@
+function (check_cache_property var prop)
+ get_property(gp_val
+ CACHE "${var}"
+ PROPERTY "${prop}")
+
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+set(var val CACHE STRING "doc")
+set_property(CACHE var PROPERTY VALUE "") # empty
+set_property(CACHE var PROPERTY ADVANCED TRUE)
+
+check_cache_property(var VALUE)
+check_cache_property(var ADVANCED)
+check_cache_property(var noexist)
diff --git a/Tests/RunCMake/get_property/directory_properties-stderr.txt b/Tests/RunCMake/get_property/directory_properties-stderr.txt
new file mode 100644
index 0000000..80c9877
--- /dev/null
+++ b/Tests/RunCMake/get_property/directory_properties-stderr.txt
@@ -0,0 +1,6 @@
+^get_directory_property: --><--
+get_property: --><--
+get_directory_property: -->value<--
+get_property: -->value<--
+get_directory_property: --><--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/directory_properties.cmake b/Tests/RunCMake/get_property/directory_properties.cmake
new file mode 100644
index 0000000..b0a9b1b
--- /dev/null
+++ b/Tests/RunCMake/get_property/directory_properties.cmake
@@ -0,0 +1,15 @@
+function (check_directory_property dir prop)
+ get_directory_property(gdp_val DIRECTORY "${dir}" "${prop}")
+ get_property(gp_val
+ DIRECTORY "${dir}"
+ PROPERTY "${prop}")
+
+ message("get_directory_property: -->${gdp_val}<--")
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+set_directory_properties(PROPERTIES empty "" custom value)
+
+check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" empty)
+check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" custom)
+check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" noexist)
diff --git a/Tests/RunCMake/get_property/global_properties-stderr.txt b/Tests/RunCMake/get_property/global_properties-stderr.txt
new file mode 100644
index 0000000..4c08ad7
--- /dev/null
+++ b/Tests/RunCMake/get_property/global_properties-stderr.txt
@@ -0,0 +1,6 @@
+^get_cmake_property: --><--
+get_property: --><--
+get_cmake_property: -->value<--
+get_property: -->value<--
+get_cmake_property: -->NOTFOUND<--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/global_properties.cmake b/Tests/RunCMake/get_property/global_properties.cmake
new file mode 100644
index 0000000..2073136
--- /dev/null
+++ b/Tests/RunCMake/get_property/global_properties.cmake
@@ -0,0 +1,16 @@
+function (check_global_property prop)
+ get_cmake_property(gcp_val "${prop}")
+ get_property(gp_val
+ GLOBAL
+ PROPERTY "${prop}")
+
+ message("get_cmake_property: -->${gcp_val}<--")
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+set_property(GLOBAL PROPERTY empty "")
+set_property(GLOBAL PROPERTY custom value)
+
+check_global_property(empty)
+check_global_property(custom)
+check_global_property(noexist)
diff --git a/Tests/RunCMake/get_property/install_properties-stderr.txt b/Tests/RunCMake/get_property/install_properties-stderr.txt
new file mode 100644
index 0000000..b1a2987
--- /dev/null
+++ b/Tests/RunCMake/get_property/install_properties-stderr.txt
@@ -0,0 +1,3 @@
+^get_property: --><--
+get_property: -->value<--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/install_properties.cmake b/Tests/RunCMake/get_property/install_properties.cmake
new file mode 100644
index 0000000..aa89225
--- /dev/null
+++ b/Tests/RunCMake/get_property/install_properties.cmake
@@ -0,0 +1,18 @@
+function (check_install_property file prop)
+ get_property(gp_val
+ INSTALL "${file}"
+ PROPERTY "${prop}")
+
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+install(
+ FILES "${CMAKE_CURRENT_LIST_FILE}"
+ DESTINATION "${CMAKE_CURRENT_LIST_DIR}"
+ RENAME "installed-file-dest")
+set_property(INSTALL "${CMAKE_CURRENT_LIST_FILE}" PROPERTY empty "")
+set_property(INSTALL "${CMAKE_CURRENT_LIST_FILE}" PROPERTY custom value)
+
+check_install_property("${CMAKE_CURRENT_LIST_FILE}" empty)
+check_install_property("${CMAKE_CURRENT_LIST_FILE}" custom)
+check_install_property("${CMAKE_CURRENT_LIST_FILE}" noexist)
diff --git a/Tests/RunCMake/get_property/source_properties-stderr.txt b/Tests/RunCMake/get_property/source_properties-stderr.txt
new file mode 100644
index 0000000..0a46f96
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties-stderr.txt
@@ -0,0 +1,6 @@
+^get_source_file_property: --><--
+get_property: --><--
+get_source_file_property: -->value<--
+get_property: -->value<--
+get_source_file_property: -->NOTFOUND<--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/source_properties.cmake b/Tests/RunCMake/get_property/source_properties.cmake
new file mode 100644
index 0000000..263ffe1
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties.cmake
@@ -0,0 +1,15 @@
+function (check_source_file_property file prop)
+ get_source_file_property(gsfp_val "${file}" "${prop}")
+ get_property(gp_val
+ SOURCE "${file}"
+ PROPERTY "${prop}")
+
+ message("get_source_file_property: -->${gsfp_val}<--")
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+set_source_files_properties(file.c PROPERTIES empty "" custom value)
+
+check_source_file_property(file.c empty)
+check_source_file_property(file.c custom)
+check_source_file_property(file.c noexist)
diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt
new file mode 100644
index 0000000..d0981ac
--- /dev/null
+++ b/Tests/RunCMake/get_property/target_properties-stderr.txt
@@ -0,0 +1,6 @@
+^get_target_property: --><--
+get_property: --><--
+get_target_property: -->value<--
+get_property: -->value<--
+get_target_property: -->gtp_val-NOTFOUND<--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake
new file mode 100644
index 0000000..c5a141d
--- /dev/null
+++ b/Tests/RunCMake/get_property/target_properties.cmake
@@ -0,0 +1,16 @@
+function (check_target_property target prop)
+ get_target_property(gtp_val "${target}" "${prop}")
+ get_property(gp_val
+ TARGET "${target}"
+ PROPERTY "${prop}")
+
+ message("get_target_property: -->${gtp_val}<--")
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+add_custom_target(tgt)
+set_target_properties(tgt PROPERTIES empty "" custom value)
+
+check_target_property(tgt empty)
+check_target_property(tgt custom)
+check_target_property(tgt noexist)
diff --git a/Tests/RunCMake/get_property/test_properties-stderr.txt b/Tests/RunCMake/get_property/test_properties-stderr.txt
new file mode 100644
index 0000000..a447280
--- /dev/null
+++ b/Tests/RunCMake/get_property/test_properties-stderr.txt
@@ -0,0 +1,6 @@
+^get_test_property: --><--
+get_property: --><--
+get_test_property: -->value<--
+get_property: -->value<--
+get_test_property: -->NOTFOUND<--
+get_property: --><--$
diff --git a/Tests/RunCMake/get_property/test_properties.cmake b/Tests/RunCMake/get_property/test_properties.cmake
new file mode 100644
index 0000000..1d0295c
--- /dev/null
+++ b/Tests/RunCMake/get_property/test_properties.cmake
@@ -0,0 +1,17 @@
+function (check_test_property test prop)
+ get_test_property("${test}" "${prop}" gtp_val)
+ get_property(gp_val
+ TEST "${test}"
+ PROPERTY "${prop}")
+
+ message("get_test_property: -->${gtp_val}<--")
+ message("get_property: -->${gp_val}<--")
+endfunction ()
+
+include(CTest)
+add_test(NAME test COMMAND "${CMAKE_COMMAND}" --help)
+set_tests_properties(test PROPERTIES empty "" custom value)
+
+check_test_property(test empty)
+check_test_property(test custom)
+check_test_property(test noexist)