diff options
94 files changed, 633 insertions, 524 deletions
diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 93bfdf8..3c053fa 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -72,6 +72,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc") endif() endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") + endif() +endif() + # use the ansi CXX compile flag for building cmake if (CMAKE_ANSI_CXXFLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") 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/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 682ce47..65b3a72 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -21,32 +21,6 @@ CMake is required to build with ancient C++ compilers and standard library implementations. Some common C++ constructs may not be used in CMake in order to build with such toolchains. -std::set const iterators ------------------------- - -The ``find()`` member function of a ``const`` ``std::set`` instance may not be -used in a comparison with the iterator returned by ``end()``: - -.. code-block:: c++ - - const std::set<std::string>& someSet = getSet(); - if (someSet.find("needle") == someSet.end()) // Wrong - { - // ... - } - -The return value of ``find()`` must be assigned to an intermediate -``const_iterator`` for comparison: - -.. code-block:: c++ - - const std::set<std::string>& someSet; - const std::set<std::string>::const_iterator i = someSet.find("needle"); - if (i != propSet.end()) // Ok - { - // ... - } - std::auto_ptr ------------- @@ -54,53 +28,6 @@ Some implementations have a ``std::auto_ptr`` which can not be used as a return value from a function. ``std::auto_ptr`` may not be used. Use ``cmsys::auto_ptr`` instead. -std::vector::insert and std::set --------------------------------- - -Use of ``std::vector::insert`` with an iterator whose ``element_type`` requires -conversion is not allowed: - -.. code-block:: c++ - - std::set<const char*> theSet; - std::vector<std::string> theVector; - theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong - -A loop must be used instead: - -.. code-block:: c++ - - std::set<const char*> theSet; - std::vector<std::string> theVector; - for(std::set<const char*>::iterator li = theSet.begin(); - li != theSet.end(); ++li) - { - theVector.push_back(*li); - } - -std::set::insert ----------------- - -Use of ``std::set::insert`` is not allowed with any source container: - -.. code-block:: c++ - - std::set<cmTarget*> theSet; - theSet.insert(targets.begin(), targets.end()); // Wrong - -A loop must be used instead: - -.. code-block:: c++ - - ConstIterator it = targets.begin(); - const ConstIterator end = targets.end(); - for ( ; it != end; ++it) - { - theSet.insert(*it); - } - -.. SunCC 5.9 - Template Parameter Defaults --------------------------- @@ -137,12 +64,6 @@ assigning the result of ``.size()`` on a container for example, the result should be assigned to ``size_t`` not to ``std::size_t``, ``unsigned int`` or similar types. -Templates ---------- - -Some template code is permitted, but with some limitations. Member templates -may not be used, and template friends may not be used. - Adding Compile Features ======================= 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 05b46c5..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 20150108) +set(CMake_VERSION_PATCH 20150112) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 7e00027..59c38e9 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1150,12 +1150,7 @@ void cmCPackWIXGenerator::CollectExtensions( std::vector<std::string> list; cmSystemTools::ExpandListArgument(variableContent, list); - - for(std::vector<std::string>::const_iterator i = list.begin(); - i != list.end(); ++i) - { - extensions.insert(*i); - } + extensions.insert(list.begin(), list.end()); } void cmCPackWIXGenerator::AddCustomFlags( diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d226a6c..5e7d764 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -1094,11 +1094,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, { // Create a contiguous array for the line this->CurrentProcessingLine.clear(); - t_BuildProcessingQueueType::iterator cit; - for ( cit = queue->begin(); cit != it; ++cit ) - { - this->CurrentProcessingLine.push_back(*cit); - } + this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(), + queue->begin(), queue->end()); this->CurrentProcessingLine.push_back(0); const char* line = &*this->CurrentProcessingLine.begin(); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 25bd96f..6598111 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -2498,11 +2498,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir) // Label the source with the target labels. LabelSet& labelSet = this->SourceLabels[source]; - for(std::vector<int>::const_iterator li = targetLabels.begin(); - li != targetLabels.end(); ++li) - { - labelSet.insert(*li); - } + labelSet.insert(targetLabels.begin(), targetLabels.end()); } } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index a6bc844..b32d47b 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -162,12 +162,9 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) //--------------------------------------------------------- void cmCTestMultiProcessHandler::LockResources(int index) { - for(std::set<std::string>::iterator i = - this->Properties[index]->LockedResources.begin(); - i != this->Properties[index]->LockedResources.end(); ++i) - { - this->LockedResources.insert(*i); - } + this->LockedResources.insert( + this->Properties[index]->LockedResources.begin(), + this->Properties[index]->LockedResources.end()); } //--------------------------------------------------------- @@ -499,11 +496,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() i != previousSet.end(); ++i) { TestSet const& dependencies = this->Tests[*i]; - for(TestSet::const_iterator j = dependencies.begin(); - j != dependencies.end(); ++j) - { - currentSet.insert(*j); - } + currentSet.insert(dependencies.begin(), dependencies.end()); } for(TestSet::const_iterator i = currentSet.begin(); @@ -526,11 +519,8 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() TestList sortedCopy; - for(TestSet::const_iterator j = currentSet.begin(); - j != currentSet.end(); ++j) - { - sortedCopy.push_back(*j); - } + sortedCopy.insert(sortedCopy.end(), + currentSet.begin(), currentSet.end()); std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp); diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 0bb1a99..52b98d7 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -349,11 +349,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions) std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) - { - P4Options.push_back(*ai); - } + P4Options.insert(P4Options.end(), args.begin(), args.end()); } CommandOptions.clear(); diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 97ec21e..4005a63 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -74,13 +74,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() std::vector<std::string> notesFiles; cmCTest::VectorOfStrings newNotesFiles; cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles); - std::vector<std::string>::iterator it; - for ( it = notesFiles.begin(); - it != notesFiles.end(); - ++ it ) - { - newNotesFiles.push_back(*it); - } + newNotesFiles.insert(newNotesFiles.end(), + notesFiles.begin(), notesFiles.end()); this->CTest->GenerateNotesFile(newNotesFiles); } @@ -91,13 +86,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() std::vector<std::string> extraFiles; cmCTest::VectorOfStrings newExtraFiles; cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles); - std::vector<std::string>::iterator it; - for ( it = extraFiles.begin(); - it != extraFiles.end(); - ++ it ) - { - newExtraFiles.push_back(*it); - } + newExtraFiles.insert(newExtraFiles.end(), + extraFiles.begin(), extraFiles.end()); if ( !this->CTest->SubmitExtraFiles(newExtraFiles)) { this->SetError("problem submitting extra files."); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 6aa1c2b..fea94ba 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -1160,11 +1160,7 @@ int cmCTestSubmitHandler::ProcessHandler() { // Submit the explicitly selected files: // - cmCTest::SetOfStrings::const_iterator it; - for (it = this->Files.begin(); it != this->Files.end(); ++it) - { - files.insert(*it); - } + files.insert(this->Files.begin(), this->Files.end()); } // Add to the list of files to submit from any selected, existing parts: @@ -1219,11 +1215,7 @@ int cmCTestSubmitHandler::ProcessHandler() // Submit files from this part. std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p); - for(std::vector<std::string>::const_iterator pi = pfiles.begin(); - pi != pfiles.end(); ++pi) - { - files.insert(*pi); - } + files.insert(pfiles.begin(), pfiles.end()); } if ( ofs ) @@ -1503,9 +1495,5 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts) //---------------------------------------------------------------------------- void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files) { - cmCTest::SetOfStrings::const_iterator it; - for (it = files.begin(); it != files.end(); ++it) - { - this->Files.insert(*it); - } + this->Files.insert(files.begin(), files.end()); } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a398864..cfb0274 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2163,11 +2163,7 @@ bool cmCTestTestHandler::SetTestsProperties( std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - for(std::vector<std::string>::iterator f = lval.begin(); - f != lval.end(); ++f) - { - rtit->LockedResources.insert(*f); - } + rtit->LockedResources.insert(lval.begin(), lval.end()); } if ( key == "TIMEOUT" ) { diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index 65d295b..3472b98 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -36,11 +36,7 @@ bool cmAddTestCommand // Collect the command with arguments. std::vector<std::string> command; - for(std::vector<std::string>::const_iterator it = args.begin() + 1; - it != args.end(); ++it) - { - command.push_back(*it); - } + command.insert(command.end(), args.begin() + 1, args.end()); // Create the test but add a generator only the first time it is // seen. This preserves behavior from before test generators. diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx index 1d5fc07..1a2efc6 100644 --- a/Source/cmCommandArgumentsHelper.cxx +++ b/Source/cmCommandArgumentsHelper.cxx @@ -50,13 +50,8 @@ void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group) if (group!=0) { this->ArgumentsBeforeEmpty = false; - for(std::vector<cmCommandArgument*>::const_iterator - argIt= group->ContainedArguments.begin(); - argIt != group->ContainedArguments.end(); - ++argIt) - { - this->ArgumentsBefore.insert(*argIt); - } + this->ArgumentsBefore.insert(group->ContainedArguments.begin(), + group->ContainedArguments.end()); } } diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 20c71fb..0ddb571 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -266,10 +266,9 @@ cmComputeLinkDepends::Compute() // Iterate in reverse order so we can keep only the last occurrence // of a shared library. std::set<int> emmitted; - const std::vector<int>& cFLO = this->FinalLinkOrder; for(std::vector<int>::const_reverse_iterator - li = cFLO.rbegin(), - le = cFLO.rend(); + li = this->FinalLinkOrder.rbegin(), + le = this->FinalLinkOrder.rend(); li != le; ++li) { int i = *li; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 8d24bd0..5cadaa6 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -408,11 +408,7 @@ cmComputeLinkInformation // Construct a mask to not bother with this behavior for link // directories already specified by the user. std::vector<std::string> const& dirs = this->Target->GetLinkDirectories(); - for(std::vector<std::string>::const_iterator di = dirs.begin(); - di != dirs.end(); ++di) - { - this->OldLinkDirMask.insert(*di); - } + this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); } } @@ -1420,11 +1416,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); } - for(std::vector<std::string>::const_iterator i = implicitDirVec.begin(); - i != implicitDirVec.end(); ++i) - { - this->FrameworkPathsEmmitted.insert(*i); - } + this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(), + implicitDirVec.end()); // Regular expression to extract a framework path and name. this->SplitFramework.compile("(.*)/(.*)\\.framework$"); @@ -1694,11 +1687,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() } // Store implicit link directories. - for(std::vector<std::string>::const_iterator i = implicitDirVec.begin(); - i != implicitDirVec.end(); ++i) - { - this->ImplicitLinkDirs.insert(*i); - } + this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end()); // Get language-specific implicit libraries. std::vector<std::string> implicitLibVec; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 73b4ba2..eb4f3a1 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -53,10 +53,7 @@ bool cmConditionEvaluator::IsTrue( cmArgumentList newArgs; // copy to the list structure - for(unsigned int i = 0; i < args.size(); ++i) - { - newArgs.push_back(args[i]); - } + newArgs.insert(newArgs.end(), args.begin(), args.end()); // now loop through the arguments and see if we can reduce any of them // we do this multiple times. Once for each level of precedence @@ -411,10 +408,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList &newArgs, // copy to the list structure cmArgumentList::iterator argP1 = arg; argP1++; - for(; argP1 != argClose; argP1++) - { - newArgs2.push_back(*argP1); - } + newArgs2.insert(newArgs2.end(), argP1, argClose); newArgs2.pop_back(); // now recursively invoke IsTrue to handle the values inside the // parenthetical expression diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 2afb029..015825d 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -131,21 +131,14 @@ const char* cmCustomCommand::GetComment() const //---------------------------------------------------------------------------- void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines) { - for(cmCustomCommandLines::const_iterator i=commandLines.begin(); - i != commandLines.end(); ++i) - { - this->CommandLines.push_back(*i); - } + this->CommandLines.insert(this->CommandLines.end(), + commandLines.begin(), commandLines.end()); } //---------------------------------------------------------------------------- void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends) { - for(std::vector<std::string>::const_iterator i=depends.begin(); - i != depends.end(); ++i) - { - this->Depends.push_back(*i); - } + this->Depends.insert(this->Depends.end(), depends.begin(), depends.end()); } //---------------------------------------------------------------------------- diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index a1fc268..a8711eb 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -125,11 +125,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, this->ValidDeps->find(obj); if (tmpIt!= this->ValidDeps->end()) { - for(DependencyVector::const_iterator i=tmpIt->second.begin(); - i != tmpIt->second.end(); ++i) - { - dependencies.insert(*i); - } + dependencies.insert(tmpIt->second.begin(), tmpIt->second.end()); haveDeps = true; } } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 4082d24..d9818ce 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -319,17 +319,13 @@ void cmDependsFortran::LocateModules() infoI != objInfo.end(); ++infoI) { cmDependsFortranSourceInfo const& info = infoI->second; - for(std::set<std::string>::const_iterator i = info.Provides.begin(); - i != info.Provides.end(); ++i) - { - // Include this module in the set provided by this target. - this->Internal->TargetProvides.insert(*i); - } + // Include this module in the set provided by this target. + this->Internal->TargetProvides.insert(info.Provides.begin(), + info.Provides.end()); for(std::set<std::string>::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { - // Include this module in the set required by this target. this->Internal->TargetRequires[*i] = ""; } } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 0254cb4..af4ce8b 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -456,11 +456,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop, } std::vector<std::string> content; cmSystemTools::ExpandListArgument(p, content); - for (std::vector<std::string>::const_iterator ci = content.begin(); - ci != content.end(); ++ci) - { - ifaceProperties.insert(*ci); - } + ifaceProperties.insert(content.begin(), content.end()); } //---------------------------------------------------------------------------- diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 79d7bcaff..69857ef 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -615,12 +615,8 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, std::vector<std::string> includes; target->GetMakefile()->GetLocalGenerator()-> GetIncludeDirectories(includes, gtgt, "C", buildType); - for(std::vector<std::string>::const_iterator dirIt=includes.begin(); - dirIt != includes.end(); - ++dirIt) - { - uniqIncludeDirs.insert(*dirIt); - } + + uniqIncludeDirs.insert(includes.begin(), includes.end()); std::string systemIncludeDirs = makefile->GetSafeDefinition( "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); @@ -628,12 +624,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, { std::vector<std::string> dirs; cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); - for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); - dirIt != dirs.end(); - ++dirIt) - { - uniqIncludeDirs.insert(*dirIt); - } + uniqIncludeDirs.insert(dirs.begin(), dirs.end()); } systemIncludeDirs = makefile->GetSafeDefinition( @@ -642,12 +633,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, { std::vector<std::string> dirs; cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); - for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); - dirIt != dirs.end(); - ++dirIt) - { - uniqIncludeDirs.insert(*dirIt); - } + uniqIncludeDirs.insert(dirs.begin(), dirs.end()); } for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin(); diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index beb6dde..013724e 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -184,10 +184,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) std::vector<std::string> shortArgs = this->Names; this->Names.clear(); // clear out any values in Names this->Names.push_back(shortArgs[0]); - for(unsigned int j = 1; j < shortArgs.size(); ++j) - { - this->UserGuessArgs.push_back(shortArgs[j]); - } + this->UserGuessArgs.insert(this->UserGuessArgs.end(), + shortArgs.begin() + 1, shortArgs.end()); } this->ExpandPaths(); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9386e42..72737b7 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -80,15 +80,12 @@ void cmFindPackageCommand::AppendSearchPathGroups() PathLabel::SystemRegistry); // Create the new path objects - this->LabeledPaths.insert( - std::pair<cmFindCommon::PathLabel, cmSearchPath>( - PathLabel::UserRegistry, cmSearchPath(this))); - this->LabeledPaths.insert( - std::pair<cmFindCommon::PathLabel, cmSearchPath>( - PathLabel::Builds, cmSearchPath(this))); - this->LabeledPaths.insert( - std::pair<cmFindCommon::PathLabel, cmSearchPath>( - PathLabel::SystemRegistry, cmSearchPath(this))); + this->LabeledPaths.insert(std::make_pair(PathLabel::UserRegistry, + cmSearchPath(this))); + this->LabeledPaths.insert(std::make_pair(PathLabel::Builds, + cmSearchPath(this))); + this->LabeledPaths.insert(std::make_pair(PathLabel::SystemRegistry, + cmSearchPath(this))); } //---------------------------------------------------------------------------- diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 556ef19..b213e80 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -271,11 +271,7 @@ bool cmFunctionCommand // create a function blocker cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker(); - for(std::vector<std::string>::const_iterator j = args.begin(); - j != args.end(); ++j) - { - f->Args.push_back(*j); - } + f->Args.insert(f->Args.end(), args.begin(), args.end()); this->Makefile->AddFunctionBlocker(f); return true; } diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index bfbe918..c8b9949 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -66,9 +66,7 @@ cmGeneratorExpressionDAGChecker::Initialize() if (it != top->Seen.end()) { const std::set<std::string> &propSet = it->second; - const std::set<std::string>::const_iterator i - = propSet.find(this->Property); - if (i != propSet.end()) + if (propSet.find(this->Property) != propSet.end()) { this->CheckResult = ALREADY_SEEN; return; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cca06bb..8d18c3a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -489,11 +489,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, unique.insert(*li); } result.clear(); - for(std::set<std::string>::iterator li = unique.begin(); - li != unique.end(); ++li) - { - result.push_back(*li); - } + result.insert(result.end(), unique.begin(), unique.end()); IncludeCacheType::value_type entry(config_upper, result); iter = this->SystemIncludesCache.insert(entry).first; @@ -822,11 +818,7 @@ cmTargetTraceDependencies = ge.Parse(*cli); cge->Evaluate(this->Makefile, "", true); std::set<cmTarget*> geTargets = cge->GetTargets(); - for(std::set<cmTarget*>::const_iterator it = geTargets.begin(); - it != geTargets.end(); ++it) - { - targets.insert(*it); - } + targets.insert(geTargets.begin(), geTargets.end()); } } diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index d8f7679..eed19f4 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/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index b93fbb3..3c07be1 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1021,12 +1021,9 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) } //insert outputs from all WirteBuild commands - for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin(); - i != this->CombinedBuildOutputs.end(); ++i) - { - //these paths have already be encoded when added to CombinedBuildOutputs - knownDependencies.insert(*i); - } + //these paths have already be encoded when added to CombinedBuildOutputs + knownDependencies.insert(this->CombinedBuildOutputs.begin(), + this->CombinedBuildOutputs.end()); //after we have combined the data into knownDependencies we have no need //to keep this data around 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/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 2dab23c..320a1f4 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -845,22 +845,14 @@ cmGlobalVisualStudioGenerator::TargetCompare cmGlobalVisualStudioGenerator::OrderedTargetDependSet ::OrderedTargetDependSet(TargetDependSet const& targets) { - for(TargetDependSet::const_iterator ti = - targets.begin(); ti != targets.end(); ++ti) - { - this->insert(*ti); - } + this->insert(targets.begin(), targets.end()); } //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::OrderedTargetDependSet ::OrderedTargetDependSet(TargetSet const& targets) { - for(TargetSet::const_iterator ti = targets.begin(); - ti != targets.end(); ++ti) - { - this->insert(*ti); - } + this->insert(targets.begin(), targets.end()); } std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir( diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index df5508e..f37d8bc 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -71,11 +71,7 @@ bool cmIncludeDirectoryCommand } if (system) { - for (std::vector<std::string>::const_iterator li = includes.begin(); - li != includes.end(); ++li) - { - systemIncludes.insert(*li); - } + systemIncludes.insert(includes.begin(), includes.end()); } } std::reverse(beforeIncludes.begin(), beforeIncludes.end()); diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index f106e1a..a007693 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -47,11 +47,8 @@ bool cmInstallFilesCommand else { this->IsFilesForm = false; - std::vector<std::string>::const_iterator s = args.begin(); - for (++s;s != args.end(); ++s) - { - this->FinalArgs.push_back(*s); - } + this->FinalArgs.insert(this->FinalArgs.end(), + args.begin() + 1, args.end()); } this->Makefile->GetLocalGenerator()->GetGlobalGenerator() diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 0405769..cc223ab 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -27,11 +27,7 @@ bool cmInstallProgramsCommand this->Destination = args[0]; - std::vector<std::string>::const_iterator s = args.begin(); - for (++s;s != args.end(); ++s) - { - this->FinalArgs.push_back(*s); - } + this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end()); this->Makefile->GetLocalGenerator()->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 52d312e..7b54b88 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -634,11 +634,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, // Parse the string to get the custom command line. cmCustomCommandLine commandLine; std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector<std::string>::iterator a = cmd.begin(); - a != cmd.end(); ++a) - { - commandLine.push_back(*a); - } + commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); // Store this command line. commandLines.push_back(commandLine); @@ -745,11 +741,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, // Parse the string to get the custom command line. cmCustomCommandLine commandLine; std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector<std::string>::iterator a = cmd.begin(); - a != cmd.end(); ++a) - { - commandLine.push_back(*a); - } + commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); // Store this command line. commandLines.push_back(commandLine); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 75231b7..ebaee37 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1856,13 +1856,8 @@ void cmLocalUnixMakefileGenerator3 { text = "Running external command ..."; } - std::set<std::string>::const_iterator dit; - for ( dit = glIt->second.GetUtilities().begin(); - dit != glIt->second.GetUtilities().end(); - ++ dit ) - { - depends.push_back(*dit); - } + depends.insert(depends.end(), glIt->second.GetUtilities().begin(), + glIt->second.GetUtilities().end()); this->AppendEcho(commands, text, cmLocalUnixMakefileGenerator3::EchoGlobal); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 8c2489a..567403f 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -328,11 +328,7 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args, // create a function blocker cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker(); - for(std::vector<std::string>::const_iterator j = args.begin(); - j != args.end(); ++j) - { - f->Args.push_back(*j); - } + f->Args.insert(f->Args.end(), args.begin(), args.end()); this->Makefile->AddFunctionBlocker(f); return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1438f7e..fae32a4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1822,11 +1822,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs, void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs) { - for(std::set<std::string>::const_iterator li = incs.begin(); - li != incs.end(); ++li) - { - this->SystemIncludeDirectories.insert(*li); - } + this->SystemIncludeDirectories.insert(incs.begin(), incs.end()); for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end(); ++l) @@ -2567,12 +2563,7 @@ std::vector<std::string> cmMakefile } std::vector<std::string> res; - - std::set<std::string>::iterator fit; - for ( fit = definitions.begin(); fit != definitions.end(); fit ++ ) - { - res.push_back(*fit); - } + res.insert(res.end(), definitions.begin(), definitions.end()); return res; } @@ -4561,16 +4552,8 @@ void cmMakefile::PopScope() this->Internal->VarInitStack.pop(); this->Internal->VarUsageStack.pop(); // Push initialization and usage up to the parent scope. - it = init.begin(); - for (; it != init.end(); ++it) - { - this->Internal->VarInitStack.top().insert(*it); - } - it = usage.begin(); - for (; it != usage.end(); ++it) - { - this->Internal->VarUsageStack.top().insert(*it); - } + this->Internal->VarInitStack.top().insert(init.begin(), init.end()); + this->Internal->VarUsageStack.top().insert(usage.begin(), usage.end()); } void cmMakefile::RaiseScope(const std::string& var, const char *varDef) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ef08c21..f8471fd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -759,13 +759,10 @@ cmMakefileTargetGenerator if(const char* extra_outputs_str = source.GetProperty("OBJECT_OUTPUTS")) { + // Register these as extra files to clean. cmSystemTools::ExpandListArgument(extra_outputs_str, outputs); - for(std::vector<std::string>::const_iterator eoi = outputs.begin()+1; - eoi != outputs.end(); ++eoi) - { - // Register this as an extra file to clean. - this->CleanFiles.push_back(*eoi); - } + this->CleanFiles.insert(this->CleanFiles.end(), + outputs.begin() + 1, outputs.end()); } // Write the rule. @@ -1174,11 +1171,7 @@ cmMakefileTargetGenerator { cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile); const std::vector<std::string>& outputs = ccg.GetOutputs(); - for(std::vector<std::string>::const_iterator o = outputs.begin(); - o != outputs.end(); ++o) - { - depends.push_back(*o); - } + depends.insert(depends.end(), outputs.begin(), outputs.end()); } } } @@ -1462,11 +1455,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( } // Make sure the extra files are built. - for(std::set<std::string>::const_iterator i = this->ExtraFiles.begin(); - i != this->ExtraFiles.end(); ++i) - { - depends.push_back(*i); - } + depends.insert(depends.end(), + this->ExtraFiles.begin(), this->ExtraFiles.end()); } // Write the driver rule. @@ -1553,11 +1543,7 @@ void cmMakefileTargetGenerator if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { std::vector<std::string> const& libDeps = cli->GetDepends(); - for(std::vector<std::string>::const_iterator j = libDeps.begin(); - j != libDeps.end(); ++j) - { - depends.push_back(*j); - } + depends.insert(depends.end(), libDeps.begin(), libDeps.end()); } } @@ -1577,12 +1563,8 @@ void cmMakefileTargetGenerator } // Add dependencies on the external object files. - for(std::vector<std::string>::const_iterator obj - = this->ExternalObjects.begin(); - obj != this->ExternalObjects.end(); ++obj) - { - depends.push_back(*obj); - } + depends.insert(depends.end(), + this->ExternalObjects.begin(), this->ExternalObjects.end()); // Add a dependency on the rule file itself. this->LocalGenerator->AppendRuleDepend(depends, diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index a01a384..ded85c3 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -899,12 +899,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::set<std::string> skipped; std::vector<std::string> skipVec; cmSystemTools::ExpandListArgument(this->SkipUic, skipVec); - - for (std::vector<std::string>::const_iterator li = skipVec.begin(); - li != skipVec.end(); ++li) - { - skipped.insert(*li); - } + skipped.insert(skipVec.begin(), skipVec.end()); makefile->AddDefinition("_skip_uic", cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); @@ -1622,12 +1617,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) std::vector<std::string> headerFilesVec; cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec); - for (std::vector<std::string>::const_iterator it = headerFilesVec.begin(); - it != headerFilesVec.end(); - ++it) - { - headerFiles.insert(*it); - } + headerFiles.insert(headerFilesVec.begin(), headerFilesVec.end()); // key = moc source filepath, value = moc output filename std::map<std::string, std::string> notIncludedMocs; @@ -2188,24 +2178,12 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, std::vector<std::string> command; command.push_back(this->MocExecutable); - for (std::list<std::string>::const_iterator it = this->MocIncludes.begin(); - it != this->MocIncludes.end(); - ++it) - { - command.push_back(*it); - } - for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin(); - it != this->MocDefinitions.end(); - ++it) - { - command.push_back(*it); - } - for(std::vector<std::string>::const_iterator it=this->MocOptions.begin(); - it != this->MocOptions.end(); - ++it) - { - command.push_back(*it); - } + command.insert(command.end(), + this->MocIncludes.begin(), this->MocIncludes.end()); + command.insert(command.end(), + this->MocDefinitions.begin(), this->MocDefinitions.end()); + command.insert(command.end(), + this->MocOptions.begin(), this->MocOptions.end()); #ifdef _WIN32 command.push_back("-DWIN32"); #endif @@ -2277,12 +2255,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5"); } - for(std::vector<std::string>::const_iterator optIt = opts.begin(); - optIt != opts.end(); - ++optIt) - { - command.push_back(*optIt); - } + command.insert(command.end(), opts.begin(), opts.end()); command.push_back("-o"); command.push_back(this->Builddir + ui_output_file); diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx index bcb8564..d8aa1cb 100644 --- a/Source/cmRemoveCommand.cxx +++ b/Source/cmRemoveCommand.cxx @@ -39,10 +39,7 @@ bool cmRemoveCommand // check for REMOVE(VAR v1 v2 ... vn) std::vector<std::string> argsExpanded; std::vector<std::string> temp; - for(unsigned int j = 1; j < args.size(); ++j) - { - temp.push_back(args[j]); - } + temp.insert(temp.end(), args.begin() + 1, args.end()); cmSystemTools::ExpandList(temp, argsExpanded); // now create the new value diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 16e71cc..fb973d4 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1269,11 +1269,7 @@ bool cmSystemTools::Split(const char* s, std::vector<std::string>& l) { std::vector<std::string> temp; bool res = Superclass::Split(s, temp); - for(std::vector<std::string>::const_iterator i = temp.begin(); - i != temp.end(); ++i) - { - l.push_back(*i); - } + l.insert(l.end(), temp.begin(), temp.end()); return res; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5d68d9d..c7b2715 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -424,12 +424,8 @@ void cmTarget::SetMakefile(cmMakefile* mf) const std::set<std::string> parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); - for (std::set<std::string>::const_iterator it - = parentSystemIncludes.begin(); - it != parentSystemIncludes.end(); ++it) - { - this->SystemIncludeDirectories.insert(*it); - } + this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(), + parentSystemIncludes.end()); const std::vector<cmValueWithOrigin> parentOptions = this->Makefile->GetCompileOptionsEntries(); @@ -1397,22 +1393,14 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, void cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs) { - for(std::set<std::string>::const_iterator li = incs.begin(); - li != incs.end(); ++li) - { - this->SystemIncludeDirectories.insert(*li); - } + this->SystemIncludeDirectories.insert(incs.begin(), incs.end()); } //---------------------------------------------------------------------------- void cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs) { - for(std::vector<std::string>::const_iterator li = incs.begin(); - li != incs.end(); ++li) - { - this->SystemIncludeDirectories.insert(*li); - } + this->SystemIncludeDirectories.insert(incs.begin(), incs.end()); } #if defined(_WIN32) && !defined(__CYGWIN__) @@ -6070,8 +6058,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // The link implementation is the default link interface. cmTarget::LinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); - std::copy(impl->Libraries.begin(), impl->Libraries.end(), - std::back_inserter(iface.Libraries)); + iface.Libraries.insert(iface.Libraries.end(), + impl->Libraries.begin(), impl->Libraries.end()); if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && !this->PolicyWarnedCMP0022 && !usage_requirements_only) { @@ -6449,11 +6437,8 @@ cmTargetInternals::ComputeLinkImplementationLanguages( // Get languages used in our source files. thisTarget->GetLanguages(languages, config); // Copy the set of langauges to the link implementation. - for(std::set<std::string>::iterator li = languages.begin(); - li != languages.end(); ++li) - { - impl.Languages.push_back(*li); - } + impl.Languages.insert(impl.Languages.begin(), + languages.begin(), languages.end()); } //---------------------------------------------------------------------------- diff --git a/Source/kwsys/EncodingC.c b/Source/kwsys/EncodingC.c index cda78e2..ba2cec2 100644 --- a/Source/kwsys/EncodingC.c +++ b/Source/kwsys/EncodingC.c @@ -44,7 +44,7 @@ wchar_t* kwsysEncoding_DupToWide(const char* str) size_t length = kwsysEncoding_mbstowcs(NULL, str, 0) + 1; if(length > 0) { - ret = malloc((length)*sizeof(wchar_t)); + ret = (wchar_t*)malloc((length)*sizeof(wchar_t)); ret[0] = 0; kwsysEncoding_mbstowcs(ret, str, length); } @@ -71,7 +71,7 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str) size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1; if(length > 0) { - ret = malloc(length); + ret = (char*)malloc(length); ret[0] = 0; kwsysEncoding_wcstombs(ret, str, length); } diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index ca9d424..1be6d02 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -547,7 +547,7 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file) } if(file) { - *pfile = malloc(strlen(file)+1); + *pfile = (char*)malloc(strlen(file)+1); if(!*pfile) { return 0; @@ -1468,7 +1468,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp) cp->RealWorkingDirectoryLength = 4096; #endif cp->RealWorkingDirectory = - malloc((size_t)(cp->RealWorkingDirectoryLength)); + (char*)malloc((size_t)(cp->RealWorkingDirectoryLength)); if(!cp->RealWorkingDirectory) { return 0; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index e4c82d8..c2b6097 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -16,6 +16,14 @@ # define _XOPEN_SOURCE_EXTENDED #endif +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) +# define KWSYS_WINDOWS_DIRS +#else +# if defined(__SUNPRO_CC) +# include <fcntl.h> +# endif +#endif + #include "kwsysPrivate.h" #include KWSYS_HEADER(RegularExpression.hxx) #include KWSYS_HEADER(SystemTools.hxx) @@ -205,8 +213,7 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft) } #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) - +#ifdef KWSYS_WINDOWS_DIRS #include <wctype.h> inline int Mkdir(const kwsys_stl::string& dir) diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index e13003f..d13f79a 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -175,6 +175,7 @@ static const char* kwsysTerminalVT100Names[] = "xterm-88color", "xterm-color", "xterm-debian", + "xterm-termite", 0 }; diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index 3f947f3..82620da 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -548,6 +548,10 @@ int main() #if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) # define _GNU_SOURCE #endif +#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 \ + && __linux && __SUNPRO_CC_COMPAT == 'G' +# include <iostream> +#endif #include <cxxabi.h> int main() { 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) @@ -1153,6 +1153,35 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then cmake_test_flags= fi + +if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then + # Are we SolarisStudio? + + TMPFILE=`cmake_tmp_file` + echo ' + #if defined(__SUNPRO_CC) + #include <iostream> + int main() { std::cout << "This is SolarisStudio" << std::endl; return 0;} + #endif + ' > ${TMPFILE}.cxx + cmake_cxx_compiler_is_solarisstudio=0 + if cmake_try_run "${cmake_cxx_compiler}" \ + "${cmake_cxx_flags} " "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then + cmake_cxx_compiler_is_solarisstudio=1 + fi + if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then + echo "${cmake_cxx_compiler} is SolarisStudio compiler" + else + echo "${cmake_cxx_compiler} is not SolarisStudio compiler" + fi + rm -f "${TMPFILE}.cxx" + + if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then + cmake_cxx_flags="${cmake_cxx_flags} -library=stlport4" + fi +fi + + # Test for kwsys features KWSYS_NAME_IS_KWSYS=0 KWSYS_BUILD_SHARED=0 |