diff options
49 files changed, 280 insertions, 42 deletions
diff --git a/Copyright.txt b/Copyright.txt index 214d7de..6c9fb09 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2014 Kitware, Inc. +Copyright 2000-2015 Kitware, Inc. Copyright 2000-2011 Insight Software Consortium All rights reserved. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 190d05c..7f518a6 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -312,6 +312,8 @@ When loading a find module or package configuration file ``find_package`` defines variables to provide information about the call arguments (and restores their original state before returning): +``CMAKE_FIND_PACKAGE_NAME`` + the ``<package>`` name which is searched for ``<package>_FIND_REQUIRED`` true if ``REQUIRED`` option was given ``<package>_FIND_QUIETLY`` 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/generator/MSYS Makefiles.rst b/Help/generator/MSYS Makefiles.rst index 0b89126..f7cfa44 100644 --- a/Help/generator/MSYS Makefiles.rst +++ b/Help/generator/MSYS Makefiles.rst @@ -1,7 +1,11 @@ MSYS Makefiles -------------- -Generates MSYS makefiles. +Generates makefiles for use with MSYS ``make`` under the MSYS shell. -The makefiles use /bin/sh as the shell. They require msys to be -installed on the machine. +Use this generator in a MSYS shell prompt and using ``make`` as the build +tool. The generated makefiles use ``/bin/sh`` as the shell to launch build +rules. They are not compatible with a Windows command prompt. + +To build under a Windows command prompt, use the +:generator:`MinGW Makefiles` generator. diff --git a/Help/generator/MinGW Makefiles.rst b/Help/generator/MinGW Makefiles.rst index ed4ccdd..9fe5fe3 100644 --- a/Help/generator/MinGW Makefiles.rst +++ b/Help/generator/MinGW Makefiles.rst @@ -1,7 +1,12 @@ MinGW Makefiles --------------- -Generates a make file for use with mingw32-make. +Generates makefiles for use with ``mingw32-make`` under a Windows command +prompt. -The makefiles generated use cmd.exe as the shell. They do not require -msys or a unix shell. +Use this generator under a Windows command prompt with MinGW in the ``PATH`` +and using ``mingw32-make`` as the build tool. The generated makefiles use +``cmd.exe`` as the shell to launch build rules. They are not compatible with +MSYS or a unix shell. + +To build under the MSYS shell, use the :generator:`MSYS Makefiles` generator. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 99088e0..2a22f14 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -36,6 +36,7 @@ Variables that Provide Information /variable/CMAKE_EXECUTABLE_SUFFIX /variable/CMAKE_EXTRA_GENERATOR /variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES + /variable/CMAKE_FIND_PACKAGE_NAME /variable/CMAKE_GENERATOR /variable/CMAKE_GENERATOR_PLATFORM /variable/CMAKE_GENERATOR_TOOLSET 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/prop_tgt/TYPE.rst b/Help/prop_tgt/TYPE.rst index 1951d46..5ac63cc 100644 --- a/Help/prop_tgt/TYPE.rst +++ b/Help/prop_tgt/TYPE.rst @@ -5,4 +5,5 @@ The type of the target. This read-only property can be used to test the type of the given target. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, -SHARED_LIBRARY, EXECUTABLE or one of the internal target types. +SHARED_LIBRARY, INTERFACE_LIBRARY, EXECUTABLE or one of the internal +target types. diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst index a5b3e8e..97a63f9 100644 --- a/Help/release/3.1.0.rst +++ b/Help/release/3.1.0.rst @@ -353,6 +353,28 @@ Deprecated and Removed Features CMake 3.1 again requires the quotes for this to work correctly. +* Prior to CMake 3.1 the Makefile generators did not escape ``#`` + correctly inside make variable assignments used in generated + makefiles, causing them to be treated as comments. This made + code like:: + + add_compile_options(-Wno-#pragma-messages) + + not work in Makefile generators, but work in other generators. + Now it is escaped correctly, making the behavior consistent + across generators. However, some projects may have tried to + workaround the original bug with code like:: + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-\\#pragma-messages") + + This added the needed escape for Makefile generators but also + caused other generators to pass ``-Wno-\#pragma-messages`` to + the shell, which would work only in POSIX shells. + Unfortunately the escaping fix could not be made in a compatible + way so this platform- and generator-specific workaround no + longer works. Project code may test the :variable:`CMAKE_VERSION` + variable value to make the workaround version-specific too. + * Callbacks established by the :command:`variable_watch` command will no longer receive the ``ALLOWED_UNKNOWN_READ_ACCESS`` access type when the undocumented ``CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS`` variable is diff --git a/Help/variable/CMAKE_FIND_PACKAGE_NAME.rst b/Help/variable/CMAKE_FIND_PACKAGE_NAME.rst new file mode 100644 index 0000000..bd1a30f --- /dev/null +++ b/Help/variable/CMAKE_FIND_PACKAGE_NAME.rst @@ -0,0 +1,6 @@ +CMAKE_FIND_PACKAGE_NAME +----------------------- + +Defined by the :command:`find_package` command while loading +a find module to record the caller-specified package name. +See command documentation for details. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 6c6a914..47d351a 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -270,11 +270,6 @@ Id flags: ${testflags} else() set(id_sdkroot "") endif() - if(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY) - set(id_code_sign_identity "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";") - else() - set(id_code_sign_identity "") - endif() if(NOT ${XCODE_VERSION} VERSION_LESS 3) set(v 3) set(ext xcodeproj) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 5524a3f..573e5aa 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -110,7 +110,7 @@ # # DESCRIPTION is an extended description of the component, used in # graphical installers to give the user additional information about the -# component. Descriptions can span multiple lines using "\n" as the +# component. Descriptions can span multiple lines using ``\n`` as the # line separator. Typically, these descriptions should be no more than # a few lines long. # @@ -185,7 +185,7 @@ # DESCRIPTION is an extended description of the component group, used in # graphical installers to give the user additional information about the # components within that group. Descriptions can span multiple lines -# using "\n" as the line separator. Typically, these descriptions +# using ``\n`` as the line separator. Typically, these descriptions # should be no more than a few lines long. # # PARENT_GROUP, if supplied, names the parent group of this group. diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index aebae27..7f686a2 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -81,7 +81,7 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ONLY_ACTIVE_ARCH = YES; - @id_code_sign_identity@ + CODE_SIGNING_REQUIRED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; SYMROOT = .; @id_toolset@ diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 29bb875..ecfc781 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -613,7 +613,7 @@ endif() set(CUDA_VERSION_STRING "${CUDA_VERSION}") # Support for arm cross compilation with CUDA 5.5 -if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") +if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.") else() set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.") @@ -621,7 +621,7 @@ endif() mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR) # Target CPU architecture -if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") +if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm") set(_cuda_target_cpu_arch_initial "ARM") else() set(_cuda_target_cpu_arch_initial "") diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 76cecc1..8493d80 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -282,21 +282,21 @@ function(_Ice_FIND) PATH_SUFFIXES ${ice_library_suffixes} DOC "Ice ${component} library") mark_as_advanced("${component_cache}") - if("${component_cache}") + if(${component_cache}) set("${component_found}" ON) list(APPEND Ice_LIBRARY "${${component_cache}}") endif() mark_as_advanced("${component_found}") set("${component_cache}" "${${component_cache}}" PARENT_SCOPE) set("${component_found}" "${${component_found}}" PARENT_SCOPE) - if("${component_found}") - if ("Ice_FIND_REQUIRED_${component}") + if(${component_found}) + if (Ice_FIND_REQUIRED_${component}) list(APPEND Ice_LIBS_FOUND "${component} (required)") else() list(APPEND Ice_LIBS_FOUND "${component} (optional)") endif() else() - if ("Ice_FIND_REQUIRED_${component}") + if (Ice_FIND_REQUIRED_${component}) set(Ice_REQUIRED_LIBS_FOUND OFF) list(APPEND Ice_LIBS_NOTFOUND "${component} (required)") else() @@ -356,7 +356,7 @@ if(Ice_FOUND) set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY") set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES") set(_Ice_component_found "${_Ice_component_upcase}_FOUND") - if("${_Ice_component_found}") + if(${_Ice_component_found}) set("${_Ice_component_lib}" "${${_Ice_component_cache}}") endif() unset(_Ice_component_upcase) diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 3905e54..45ca1d4 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -106,7 +106,7 @@ find_library(SDL_LIBRARY_TEMP ) if(NOT SDL_BUILDING_LIBRARY) - if(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") + if(NOT SDL_INCLUDE_DIR MATCHES ".framework") # Non-OS X framework versions expect you to also dynamically link to # SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms # seem to provide SDLmain for compatibility even though they don't diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 1fb8f30..a636d23 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -266,9 +266,10 @@ 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 = this->FinalLinkOrder.rbegin(), - le = this->FinalLinkOrder.rend(); + li = cFLO.rbegin(), + le = cFLO.rend(); li != le; ++li) { int i = *li; 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/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index e344df4..a05719d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -110,13 +110,26 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() << "\n\n"; #endif + // Write rules for languages compiled in this target. std::set<std::string> languages; - this->GetTarget()->GetLanguages(languages, - this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); + std::vector<cmSourceFile*> sourceFiles; + this->GetTarget()->GetSourceFiles(sourceFiles, + this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); + for(std::vector<cmSourceFile*>::const_iterator + i = sourceFiles.begin(); i != sourceFiles.end(); ++i) + { + const std::string& lang = (*i)->GetLanguage(); + if(!lang.empty()) + { + languages.insert(lang); + } + } for(std::set<std::string>::const_iterator l = languages.begin(); l != languages.end(); ++l) + { this->WriteLanguageRules(*l); + } } const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 816e6d8..b8cc5fb 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -454,7 +454,10 @@ cmNinjaTargetGenerator std::vector<std::string> compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); - compileCmds.front().insert(0, cldeps); + if (!compileCmds.empty()) + { + compileCmds.front().insert(0, cldeps); + } for (std::vector<std::string>::iterator i = compileCmds.begin(); i != compileCmds.end(); ++i) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index b833d3f..12eb411 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -24,7 +24,7 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name): this->CustomCommand = 0; this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); this->FindFullPathFailed = false; - this->IsUiFile = ("ui" == + this->IsUiFile = (".ui" == cmSystemTools::GetFilenameLastExtension(this->Location.GetName())); } 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/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index a9cad14..f654330 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -255,6 +255,7 @@ if(BUILD_TESTING) endif() ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) + ADD_TEST_MACRO(CxxSubdirC CxxSubdirC) ADD_TEST_MACRO(IPO COnly/COnly) ADD_TEST_MACRO(OutDir runtime/OutDir) ADD_TEST_MACRO(ObjectLibrary UseCshared) diff --git a/Tests/CxxSubdirC/CMakeLists.txt b/Tests/CxxSubdirC/CMakeLists.txt new file mode 100644 index 0000000..52474f8 --- /dev/null +++ b/Tests/CxxSubdirC/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.0) +project(CxxSubdirC CXX) +add_subdirectory(Cdir) +add_executable(CxxSubdirC main.cxx $<TARGET_OBJECTS:Cobj>) diff --git a/Tests/CxxSubdirC/Cdir/CMakeLists.txt b/Tests/CxxSubdirC/Cdir/CMakeLists.txt new file mode 100644 index 0000000..08a8757 --- /dev/null +++ b/Tests/CxxSubdirC/Cdir/CMakeLists.txt @@ -0,0 +1,2 @@ +enable_language(C) +add_library(Cobj OBJECT Cobj.c) diff --git a/Tests/CxxSubdirC/Cdir/Cobj.c b/Tests/CxxSubdirC/Cdir/Cobj.c new file mode 100644 index 0000000..75a0045 --- /dev/null +++ b/Tests/CxxSubdirC/Cdir/Cobj.c @@ -0,0 +1 @@ +int Cobj(void) { return 0; } diff --git a/Tests/CxxSubdirC/main.cxx b/Tests/CxxSubdirC/main.cxx new file mode 100644 index 0000000..049220f --- /dev/null +++ b/Tests/CxxSubdirC/main.cxx @@ -0,0 +1,2 @@ +extern "C" int Cobj(void); +int main() { return Cobj(); } diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 3fd00b8..de4d0d2 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -73,6 +73,12 @@ if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" AND NOT CMAKE_CONFIGURATION_ add_definitions(-DTEST_DEBUG_CLASS) endif() +# The -no-protection option disables the generation of include guards. Verify +# that setting the source file property has an effect by using this and +# issue an error in the preprocessor in calwidget.cpp if the include guard +# is defined. +set_source_files_properties(calwidget.ui PROPERTIES AUTOUIC_OPTIONS "-no-protection") + add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp multiplewidgets.cpp xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> diff --git a/Tests/QtAutogen/calwidget.cpp b/Tests/QtAutogen/calwidget.cpp index defde20..5f59994 100644 --- a/Tests/QtAutogen/calwidget.cpp +++ b/Tests/QtAutogen/calwidget.cpp @@ -50,6 +50,9 @@ #include "calwidget.h" #include "ui_calwidget.h" + #ifdef UI_CALWIDGET_H + #error Definition of UI_CALWIDGET_H should be disabled by file option. + #endif Window::Window() : ui(new Ui::Window) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fd3bb03..642665b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -102,6 +102,7 @@ add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(file) 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/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) @@ -145,7 +145,7 @@ if ${cmake_system_linux}; then cmake_machine_parisc=true fi elif ${cmake_system_hpux}; then - if !(uname -m | grep ia64 >/dev/null 2>&1); then + if uname -m | grep ia64 >/dev/null 2>&1; then : ; else cmake_machine_parisc=true fi fi |