summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeCommands
Commit message (Collapse)AuthorAgeFilesLines
* target_link_libraries: Fix out-of-dir linking of a list of targetsBrad King2020-01-161-2/+3
| | | | | | | | | | | | | | In a case like target_link_libraries(targetInOtherDir PUBLIC "$<1:a;b>") then all entries in the list need to be looked up in the caller's scope. Previously our `::@(directory-id)` suffix would apply only to the last entry. Instead surround the entire entry by a pair `::@(directory-id);...;::@` so that the `::@` syntax can encode a directory lookup scope change evaluated as the list is processed. Fixes: #20204
* target_link_libraries: Fix out-of-dir calls with debug/optimized keywordsBrad King2020-01-101-1/+1
| | | | | | | | | | In commit a1ad0a699b (target_link_libraries: Allow use with targets in other directories, 2018-09-07, v3.13.0-rc1~94^2) we added use of `<...>` to encode a directory id, but the closing `>` can incorrectly terminate a surrounding generator expression early. Encode the directory id using `(...)` instead. Fixes: #20202
* target_link_libraries: Add FIXME comment for out-of-dir genex listBrad King2020-01-101-0/+3
| | | | Issue: #20204
* Revise include order using clang-format-6.0Kitware Robot2019-10-018-11/+5
| | | | | Run the `clang-format.bash` script to update our C and C++ code to a new include order `.clang-format`. Use `clang-format` version 6.0.
* Genex: CompileLang and CompileLangAndId now match against a list of idsRobert Maynard2019-06-035-0/+22
| | | | | | This allows for expressions such as: $<COMPILE_LANG_AND_ID, CXX, GNU, Clang>
* Genex: CompilerId now can match against a list of ids.Robert Maynard2019-06-033-2/+41
| | | | | This allows for expressions like: $<$<CXX_COMPILER_ID:Clang,GNU>:-DMY_PRIVATE_DEFINE>
* Genex: Add COMPILE_LANG_AND_ID generator expressionRobert Maynard2019-05-141-1/+1
|
* target_link_libraries: Fix static library private deps in other dirsBrad King2019-04-304-0/+30
| | | | | | | | | | | | In commit a1ad0a699b (target_link_libraries: Allow use with targets in other directories, 2018-09-07, v3.13.0-rc1~94^2) we accidentally broke the logic that adds `$<LINK_ONLY:...>` to private dependencies of static libraries in their `INTERFACE_LINK_LIBRARIES` in the case that the dependency is added from outside the directory creating the library. The check for a valid target name should apply to the original name specified by the caller and not the encoded cross-directory reference. Fixes: #19197
* link_directories(): enhance capabilitiesMarc Chevrier2018-09-252-0/+34
|
* LINK_DIRECTORIES: Add new properties and commandsMarc Chevrier2018-09-253-0/+49
| | | | | | | | | | | | These new capabilities enable to manage link directories Two new properties: * target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES One new command * target_link_directories(): to populate target properties Fixes: #17215
* Merge topic 'link-options'Brad King2018-09-171-0/+8
|\ | | | | | | | | | | | | 6da8b67c3f target_link_options: fix erroneous handling of BEFORE keyword. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2384
| * target_link_options: fix erroneous handling of BEFORE keyword.Marc Chevrier2018-09-141-0/+8
| |
* | target_link_libraries: Allow use with targets in other directoriesBrad King2018-09-126-0/+84
|/ | | | | | | | | | | | | | | | | | | | | Previously the command did not allow naming targets on the LHS that were not created in the calling directory. Lift this restriction to enable more flexible use by projects. Targets named on the RHS will need to be looked up during generation in the scope of the call site rather than the scope of the LHS target. Introduce an internal syntax in `[INTERFACE_]LINK_LIBRARIES` properties to specify target names that need to be looked up in a directory other than that containing the target on which the property is set. Add minimal documentation of the syntax to help users that encounter it. Unfortunately CMake previously did allow such calls in the case that only `INTERFACE` libraries are specified, but those libraries would be looked up in the target's directory rather than the caller's. Add policy `CMP0079` to enable the new behavior with new lookup scope in a compatible way. Fixes: #17943
* LINK_OPTIONS property: add test for static library.Marc Chevrier2018-08-151-1/+8
| | | | | | | Check that property INTERFACE_LINK_OPTIONS is correctly propagated from static libraries. Issue: #18251
* Merge topic 'subdir_target_sources'Craig Scott2018-06-198-0/+135
|\ | | | | | | | | | | | | 316815e1f4 target_sources: Interpret relative paths as relative to the calling directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2128
| * target_sources: Interpret relative paths as relative to the calling directoryPatrick Stotko2018-06-188-0/+135
| | | | | | | | | | | | | | | | | | | | Previously the command considered non-absolute source file paths relative to the associated target on the LHS. This causes problems in incremental builds where files are added from subdirectories and forces users to workaround by manually converting to absolute paths. Change this to enable more intuitive usage by projects. Fixes #17981
* | LINK_OPTIONS: Add new family of propertiesMarc Chevrier2018-06-064-0/+50
|/ | | | | | | | | | | | | | This family enable to manage link flags Three new properties: * directory property: LINK_OPTIONS * target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS Two new commands * add_link_options(): to populate directory property * target_link_options(): to populate target properties Fixes: #16543
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-0113-108/+108
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * 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.
* add_compile_definitions: add new commandMarc Chevrier2018-04-202-0/+32
| | | | | | | This command manages preprocessor definitions at directory level and supports generator expressions. Fixes: #15374
* Features: Record C features for MSVCBrad King2018-03-291-3/+3
| | | | | | | | | The MSVC C compiler has no notion of C language standards or flags. Tell CMake to assume that all language standards are available. Record available C language features depending on the version of the compiler. Fixes: #17858
* 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>