summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeCommands
Commit message (Collapse)AuthorAgeFilesLines
* Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and XcodeBrad King2018-01-123-16/+20
| | | | | | | | | | | | | | | The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `INCLUDE_DIRECTORIES` to match the selected language. This is not exactly the same as for other generators, but is the best VS and Xcode can do. It is also sufficient for many use cases since the set of include directories for C and C++ is frequently similar but may be distinct from those for other languages like CUDA. Fixes: #17435
* Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and XcodeBrad King2018-01-123-14/+30
| | | | | | | | | | | | | | | The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `COMPILE_DEFINITIONS` to match the selected language. This is not exactly the same as for other generators, but is the best VS and Xcode can do. It is also sufficient for many use cases since the set of definitions for C and C++ is frequently similar but may be distinct from those for other languages like CUDA. Issue: #17435
* Genex: Enable COMPILE_LANGUAGE for COMPILE_OPTIONS with Visual StudioBrad King2017-11-203-14/+31
| | | | | | | | | | | | | | | | | | | Since commit v3.9.0-rc4~3^2~1 (VS: Fix target_compile_options for CUDA, 2017-06-21), the evaluation of `COMPILE_LANGUAGE` receives the proper language. The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `COMPILE_OPTIONS` to match the selected language. This is not exactly the same as for other generators, but is the best VS can do. It is also sufficient for many use cases since the set of allowed flags for C and C++ is almost the same in Visual Studio. Furthermore, since the VS generator moves many of the flags to declarative `.vcxproj` elements, it will automatically avoid passing C++ flags for C sources. Issue: #17435
* CompileFeatures: Makes tests work with meta-feature onlyChuck Atkins2017-05-292-30/+45
|
* Tests: Ensure Solaris linker never sees empty contentsCraig Scott2017-05-181-1/+3
| | | | | Fixes the following tests on Solaris builds: wrapping, qtwrapping and CMakeCommands.target_link_libraries
* Tests: use cxx_auto_type only if actually availableRolf Eike Beer2017-01-251-1/+1
| | | | | The presence of CMAKE_CXX_COMPILE_FEATURES doesn't mean cxx_auto_type is always available.
* Revise C++ coding style using clang-formatKitware Robot2016-05-1630-107/+130
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-292-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Tests: Do not try to use invalid "ld -v" flag on SolarisBrad King2015-03-311-1/+11
| | | | | Fix the CMakeCommands.target_link_libraries test to use "-V" instead of "-v" on Solaris because the latter does not exist.
* Genex: Allow COMPILE_LANGUAGE when processing include directories.Stephen Kelly2015-03-095-0/+37
| | | | Issue an error if this is encountered by an IDE generator.
* Genex: Allow COMPILE_LANGUAGE when processing compile definitions.Stephen Kelly2015-03-093-0/+56
| | | | Issue an error if this is encountered by an IDE generator.
* Genex: Enable use of COMPILE_LANGUAGE for compile options.Stephen Kelly2015-03-093-0/+56
| | | | | | Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators.
* Features: Extend concept to C language.Stephen Kelly2014-05-145-11/+73
| | | | | | | | | | | Add properties and variables corresponding to CXX equivalents. Add features for c_function_prototypes (C90), c_restrict (C99), c_variadic_macros (C99) and c_static_assert (C11). This feature set can be extended later. Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader to conditionally represent the c_restrict feature.
* Tests: Execute compile features tests unconditionally.Stephen Kelly2014-04-171-0/+8
| | | | Conditionally create a dummy test if there are no known features.
* Add target_compile_features command.Stephen Kelly2014-04-076-0/+49
| | | | | | | | | | | This can be used to set the compiler features required by particular targets. An error is issued at CMake time if the compiler does not support the required feature. If a language dialect flag is required by the features used, that will be added automatically. Base the target_compile_features command on cmTargetPropCommandBase. This gives us 'free' handling of IMPORTED, ALIAS, INTERFACE, non-compilable and missing targets.
* cmTarget: Don't update IMPORTED target compilation propertiesStephen Kelly2014-01-043-0/+21
| | | | | | The include_directories() and add_compile_options() commands should not append to the corresponding target property for IMPORTED targets. This is already the case for add_definitions().
* target_include_directories: Allow relative path with genexStephen Kelly2013-11-263-1/+9
| | | | | | | | | | | | | | | Treat paths which are relative and which contain a generator expression which is not at the beginning as relative to the source directory. This matches the behavior of paths which are relative but contain no generator expression at all. Previously this would generate a relative path with the IMPORTED target on export(), which would be a reported as a non-existent path on import. If used directly in the buildsystem, it would be reported as a relative path, which is also an error. There is no need for a policy in this case.
* Merge branch 'policy-CMP0022-fixes' into policy-CMP0022-fixes-for-masterBrad King2013-11-036-0/+56
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolve conflict in Source/cmTarget.cxx by integrating the changes to the internal copy constructor from both sides. Also resolve a logical conflict by dropping the special case for INTERFACE_LIBRARY targets. Since cmTarget::SetMakefile already forces CMP0022 to NEW for such targets we need no special handling. Resolve conflict in Source/cmTargetLinkLibrariesCommand.h by dropping the documentation change. We will make the same change in the new location of the same documentation in a separate commit. Resolve conflicts in Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt Tests/RunCMake/CMP0022/RunCMakeTest.cmake by taking the side from the 'policy-CMP0022-fixes' branch.
| * CMP0022: Add test for target_link_libraries plain signatureStephen Kelly2013-11-026-0/+56
| |
* | Merge topic 'fix-tll-static-private'Brad King2013-10-261-0/+3
|\ \ | |/ | | | | | | 239b0c6 Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
| * Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.Stephen Kelly2013-10-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Only valid target names or generator expressions may appear in the target field of a LINK_ONLY expression. Other content like link flags should still be added to that property (wrapped in config-specific generator expressions), but not wrapped in LINK_ONLY. Otherwise undue warnings would be issued for the policy CMP0022. The LINK_ONLY expression only has an effect for actual target names anyway, so there is no logical deficit.
* | target_link_libraries: Allow repeated use of LINK_{PRIVATE,PUBLIC} keywords.Stephen Kelly2013-10-171-3/+3
|/ | | | | | | This has not been allowed since they were introduced in commit 91438222 (target_link_libraries: Add LINK_(PUBLIC|PRIVATE) options, 2011-10-07), but allowing this form makes it more compatible with the newer PUBLIC and PRIVATE keywords.
* Allow target commands to be invoked with no items (#14325).Stephen Kelly2013-07-313-0/+24
| | | | | | | | Code such as target_include_directories(foo PRIVATE ${items}) should not work or break based on whether items is defined or not.
* cmTarget: Fix iface libraries and languages for static libraries.Stephen Kelly2013-07-266-0/+29
|
* target_link_libraries: Add PUBLIC/PRIVATE/INTERFACE keyword signatureStephen Kelly2013-07-242-0/+25
| | | | | | | Add a new signature to help populate INTERFACE_LINK_LIBRARIES and LINK_LIBRARIES cleanly in a single call. Add policy CMP0023 to control whether the keyword signatures can be mixed with uses of the plain signatures on the same target.
* TLL: Don't populate old link interface if CMP0022 is NEW.Stephen Kelly2013-07-087-0/+58
| | | | | | | | | | | | | Always populate the INTERFACE_LINK_LIBRARIES for interface entries. Don't populate the old interface properties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if CMP0022 is NEW. Because the INTERFACE_LINK_LIBRARIES property is now populated by the target_link_libraries when operating on a static library, make an equivalent change which populates the property with the same value when the old link_libraries() command is used. This silences the policy warning in that case.
* Introduce add_compile_options command.Stephen Kelly2013-06-042-0/+25
| | | | | | | | | | | | | | | | | This command is similar to add_definitions, in that it affects the compile options of all targets which follow it. The implementation is similar to the implementation of the include_directories command, in that it is based on populating a COMPILE_OPTIONS directory property and using that to initialize the same property on targets. Unlike the include_directories command however, the add_compile_options command does not affect previously defined targets. That is, in the following code, foo will not be compiled with -Wall, but bar will be: add_library(foo ...) add_compile_options(-Wall) add_library(bar ...)
* Add target_compile_options command.Stephen Kelly2013-06-023-0/+71
| | | | This command populates the COMPILE_OPTIONS target property.
* Test that linking using the debug keyword to tll works.Stephen Kelly2013-05-161-0/+8
|
* Rename variable for including current directory in interfacesBrad King2013-03-191-1/+1
| | | | | | | | | Rename the variable added by commit 9ce1b9ef (Add CMAKE_BUILD_INTERFACE_INCLUDES build-variable, 2012-11-25) to CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE to be more consistent with the existing CMAKE_INCLUDE_CURRENT_DIR variable. Suggested-by: Alex Neundorf <neundorf@kde.org>
* Merge topic 'fix-transitive-target-names'Brad King2013-03-122-0/+8
|\ | | | | | | | | | | 1bdd167 Restore support for target names with '+' (#13986) 254687d Only process transitive interface properties for valid target names.
| * Restore support for target names with '+' (#13986)Stephen Kelly2013-03-122-0/+8
| | | | | | | | | | | | | | | | | | Extend the range of valid target names with the + sign. This character can commonly be used for target names, such as those containing 'c++'. Add a test but skip it for Borland and Watcom tools which do not support the character. Suggested-By: Benjamin Kloster
* | Remove unused parameters from target_link_libraries tests.Stephen Kelly2013-03-063-3/+3
|/
* Revert "Add the TARGET_DEFINED generator expression"Stephen Kelly2013-02-252-10/+0
| | | | | | | | | | | | | | | | This reverts commit 2bee6f5ba5b3f33817cc00e056a7df60d05c9399. This expression is not used, and has a semantic which is not completely optimal (namely considering utility targets to be targets, though usually we are interested in linkable targets). Remove it so that we have more freedom to define better expressions in the future. Conflicts: Source/cmGeneratorExpressionEvaluator.cxx Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt Tests/CMakeCommands/target_compile_definitions/consumer.cpp
* Remove use of TARGET_DEFINED from the target_link_libraries test.Stephen Kelly2013-02-251-4/+4
| | | | | | Update the unit test introduced in commit 57175d55 (Only use early evaluation termination for transitive properties., 2013-02-07) to not use the expression, but still test the appropriate code.
* Remove use of TARGET_DEFINED from target_include_directories test.Stephen Kelly2013-02-251-3/+3
| | | | | | | Change the unit test introduced in commit 24dcf0c0 (Make sure generator expressions can be used with target_include_directories., 2013-01-16) to not use the expression, but still test the appropriate code.
* Revert "Add the $<LINKED:...> generator expression."Stephen Kelly2013-02-134-23/+0
| | | | | | | | | This reverts commit 0b92602b816e2584db3781b120a1e5200da72ada. Conflicts: Source/cmGeneratorExpressionEvaluator.cxx Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt Tests/CMakeCommands/target_include_directories/CMakeLists.txt
* Don't use LINKED where not needed.Stephen Kelly2013-02-122-2/+2
|
* Only use early evaluation termination for transitive properties.Stephen Kelly2013-02-071-1/+4
| | | | | | We need to make sure expressions which evaluate TARGET_PROPERTY:TYPE multiple times for example get the correct result each time, and not an empty string instead.
* Add includes and compile definitions with target_link_libraries.Stephen Kelly2013-01-314-4/+51
| | | | | | | | This establishes that linking is used to propagate usage-requirements between targets in CMake code. The use of the target_link_libraries command as the API for this is chosen because introducing a new command would introduce confusion due to multiple commands which differ only in a subtle way.
* Add the $<LINKED:...> generator expression.Stephen Kelly2013-01-314-1/+25
| | | | | | This is both a short form of using a TARGET_DEFINED expression together with a TARGET_PROPERTY definition, and a way to strip non-target content from interface properties when exporting.
* Make subclasses responsible for joining content.Stephen Kelly2013-01-295-0/+13
| | | | | This way we can add handling of relative/absolute paths and of -D in compile definitions.
* Don't allow targets args in the new target commands.Stephen Kelly2013-01-292-2/+2
|
* Merge topic 'disallow-IMPORTED-interface-porcelain'Brad King2013-01-235-27/+2
|\ | | | | | | | | | | b98d14d Disallow porcelain to populate includes and defines of IMPORTED targets. 48a4cf2 Revert "Allow target_link_libraries with IMPORTED targets."
| * Disallow porcelain to populate includes and defines of IMPORTED targets.Stephen Kelly2013-01-214-24/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With similar reasoning to the parent commit, as downstreams, we can't determine what $<CONFIG> generator expressions would be appropriate. Upstream would have populated the INTERFACE_INCLUDE_DIRECTORIES with config-specific generator expressions, possibly appropriate for their DEBUG_CONFIGURATIONS. In theory, if we would add include directories for a DEBUG intent, we would have to match the upstream configurations for that. Rather than attempting to discover the appropriate configurations at this time, simplify the feature instead. The use of IMPORTED targets with these commands could still be added in the future if targets would export their DEBUG_CONFIGURATIONS somehow.
| * Revert "Allow target_link_libraries with IMPORTED targets."Stephen Kelly2013-01-211-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9cfe4f1b769597bd9ba179eba46572a9df27f64c. It turns out that correctly adding the content to the IMPORTED_LINK_INTERFACE_LIBARIES_<CONFIG> of an upstream target from the buildsystem of a downstream project is not simple. If upstream had added the INTERFACE content, the config-specific properties would be determined by the DEBUG_CONFIGURATIONS of upstream. As downstream, we don't have any information about what the DEBUG_CONFIGURATIONS of upstream were, so we can't determine which configuration-specific properties to populate. The best we can do is add it to all of them or add it to the ones downstream considers to be DEBUG_CONFIGURATIONS, neither of which is a good solution. So, removing the porcelain API for that is the best approach. A human can still determine which properties to populate and use the set_property API to populate the desired properies. Another solution to this would be for upstream targets to publish what they consider DEBUG_CONFIGURATIONS, but that can be added in a future release.
* | Make sure generator expressions can be used with target_include_directories.Stephen Kelly2013-01-161-1/+6
|/ | | | | Handle the case that a generator expression is used before treating a non-target as an error.
* Add the TARGET_DEFINED generator expressionStephen Kelly2013-01-132-0/+10
| | | | This tests whether the parameter is a usable target.
* Allow generator expressions in LINK_INTERFACE_LIBRARIES.Stephen Kelly2013-01-104-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Config and IMPORTED_ variants may also contain generator expressions. If 'the implementation is the interface', then the result of evaluating the expressions at generate time is used to populate the IMPORTED_LINK_INTERFACE_LIBRARIES property. 1) In the case of non-static libraries, this is fine because the user still has the option to populate the LINK_INTERFACE_LIBRARIES with generator expressions if that is what is wanted. 2) In the case of static libraries, this prevents a footgun, enforcing that the interface and the implementation are really the same. Otherwise, the LINK_LIBRARIES could contain a generator expression which is evaluated with a different context at build time, and when used as an imported target. That would mean that the result of evaluating the INTERFACE_LINK_LIBRARIES property for a static library would not necessarily be the 'link implementation'. For example: add_library(libone STATIC libone.cpp) add_library(libtwo STATIC libtwo.cpp) add_library(libthree STATIC libthree.cpp) target_link_libraries(libtwo $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>:libone>) target_link_libraries(libthree libtwo) If the LINK_LIBRARIES content was simply copied to the IMPORTED_LINK_INTERFACE_LIBRARIES, then libthree links to libone, but executables linking to libthree will not link to libone. 3) As the 'implementation is the interface' concept is to be deprecated in the future anyway, this should be fine.
* Merge topic 'target-includes-defines-commands'Brad King2013-01-106-0/+157
|\ | | | | | | | | | | fc61a7a Add the target_compile_definitions command. 8a37ebe Add the target_include_directories command.