summaryrefslogtreecommitdiffstats
path: root/Tests/ExportImport
Commit message (Collapse)AuthorAgeFilesLines
* target_link_libraries: Allow use with targets in other directoriesBrad King2018-09-127-0/+66
| | | | | | | | | | | | | | | | | | | | | 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
* Tests: Add test for $<0:...> in ExportImportKyle Edwards2018-07-171-3/+3
| | | | | This test case already includes test cases for $<1...> and $<0...>, but this commit adds a few $<0:...>'s in cases where it was missing.
* LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDSMarc Chevrier2018-06-272-0/+21
| | | | Fixes: #17997
* LINK_OPTIONS: Add new family of propertiesMarc Chevrier2018-06-063-0/+23
| | | | | | | | | | | | | | 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-0126-70/+70
| | | | | | | | | | | | 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.
* Export: allow exporting of additional propertiesWouter Klouwen2018-03-162-0/+22
| | | | | | | | | This change introduces an additional property that may be set on a target to allow additional properties to be exported. Normally only a limited number of properties are exported. Additional properties may be exported by simply setting the `EXPORT_PROPERTIES` property on a target that is exported.
* Tests: Add cases for usage requirements of linked object libsBrad King2018-03-018-19/+91
| | | | | | | Add tests to cover transitive usage requirements on installation and export of targets that link to object libraries. Issue: #14778
* install,export: Maybe transform OBJECT libraries to INTERFACE librariesBrad King2018-02-283-5/+31
| | | | | | | | | | | Teach the `install` and `export` commands to support installing and exporting `OBJECT` libraries without their object files. Transform them to `INTERFACE` libraries in such cases. For `install(TARGETS)`, activate this when no destination for the object files is specified. For `export`, activate this only under Xcode with multiple architectures when we have no well-defined object file locations to give to clients.
* GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in TestsCraig Scott2017-12-291-2/+3
|
* Tests: Make function name not match SONAMECraig Scott2017-05-181-1/+1
| | | | | | | | We look for `SONAME` in the output of `readelf` to check whether the binary contains the field. Do not provide a symbol that may accidentally match. Fixes: #16894
* Allow OBJECT libraries to be installed, exported, and importedRobert Maynard2017-04-186-1/+42
| | | | | | | | Teach install() and export() to handle the actual object files. Disallow this on Xcode with multiple architectures because it still cannot be cleanly supported there. Co-Author: Brad King <brad.king@kitware.com>
* Tests: ExportImport C code should use explicit (void) in prototypesRobert Maynard2017-04-181-12/+12
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-1639-116/+173
| | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Drop Visual Studio 6 generatorBrad King2016-03-093-10/+2
| | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* Fix export of STATIC library PRIVATE dependencies with CMP0022 NEWBrad King2016-01-153-1/+13
| | | | | | | | | | | | | | The target_link_libraries command records the PRIVATE dependencies of a STATIC library in INTERFACE_LINK_LIBRARIES as "$<LINK_ONLY:dep>". This hides the target name from export namespacing logic inside a generator expression. When user-written generator expressions reference a target name they must put it inside a "$<TARGET_NAME:dep>" expression to allow the export logic to rename the target. In the case that the private dependency is not already a generator expression, target_link_libraries must use "$<LINK_ONLY:$<TARGET_NAME:dep>>" to allow the export logic to rename the target. Reported-by: Tamás Kenéz <tamas.kenez@gmail.com>
* Tests: Use CMP0022 NEW behavior in some ExportImport casesBrad King2016-01-151-0/+3
|
* Tests: Isolate policy changes in ExportImport testBrad King2016-01-151-2/+5
| | | | Use cmake_policy(PUSH/POP) to isolate CMP0022 policy changes.
* install: Allow generator expressions in DIRECTORYYves Frederix2016-01-131-1/+1
| | | | | Teach install(DIRECTORY) to support generator expressions in the list of directories, much like install(FILES) already supports.
* Merge topic 'test-fix-C-comments'Brad King2015-09-281-11/+11
|\ | | | | | | | | 4eb77a1c Tests: Use C-Style comments in C sources and headers
| * Tests: Use C-Style comments in C sources and headersMarc Chevrier2015-09-251-11/+11
| | | | | | | | | | Not all C compilers tolerate C++-style comments in C code, so do not use them in our tests.
* | install: Allow generator expressions in DIRECTORY DESTINATIONRobert Goulet2015-09-241-1/+1
|/
* Tests: Cover install(FILES) with a genex DESTINATIONBrad King2015-09-231-2/+2
|
* Tests: Use a less strict regular expression to look for "SONAME"Raphael Kubo da Costa2015-09-012-2/+2
| | | | | | | | | | | | | | | | | | | Commit 899458ab (Tests: Cover NO_SONAME property for SHARED libraries, 2015-08-20) introduced a few new ExportImport tests, and the check_lib_{no}soname.cmake scripts that parse readelf(1)'s output. Make the regular expression matching the SONAME line output by readelf less strict, as the output format varies across implementations: GNU binutils' readelf is the only one to write each ELF header within parentheses (which the previous regular expression expected). The new tests were thus failing when either Fedora's elfutils (eu-readelf) or elftoolchain's readelf (present on recent FreeBSD versions) were being used, as they both list the headers without parentheses. The same issue also affected Tests/Plugin's check_mod_soname.cmake, so fix that one as well -- the only reason the test was not failing is that it tested that the regular expression did not match, which was always the case with a non-binutils readelf.
* Tests: Cover NO_SONAME property for SHARED librariesBrad King2015-08-205-0/+70
| | | | | | | | This property was added by commit v2.8.9~204^2~2 (Support building shared libraries or modules without soname, 2012-04-22). A test for using the property on MODULE libraries was added by commit v2.8.9~204^2~1 (Test NO_SONAME property, 2012-04-23). Add such a test for SHARED libraries too.
* Add generator expression support to OUTPUT_DIRECTORY target propertiesRobert Goulet2015-08-124-3/+53
| | | | | | | If {ARCHIVE,LIBRARY,RUNTIME}_OUTPUT_DIRECTORY is set with a genex then do not add the per-config subdirectory on multi-config generators. This will allow projects to use $<CONFIG> to place the per-config part of the directory path somewhere other than the end.
* Add generator expression support to OUTPUT_NAME target propertyRobert Goulet2015-07-094-3/+13
|
* Export: Escape exported property values when writing CMake language filesBrad King2015-06-242-0/+15
| | | | | | | | When writing export files, correctly encode property values that contain characters special to the CMake language parser. We must ensure that they parse correctly when loaded on the consuming side. Reported-by: Dan Liew <dan@su-root.co.uk>
* Tests: Fix ExportImport on AIX with GCCBrad King2015-04-231-0/+1
| | | | | | | | | | | | | | | | | | | | | The iface_test_bld gets the excludedFromAll include directory with "-isystem" because it is added indirectly through an imported target. On AIX with GCC the -isystem flag causes sources to be preprocessed as: # 3 "/.../excludedFromAll.h" 2 3 4 The flags after the file name are documented here: https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html and the "4" flag says that following content is extern "C". This causes the excludedFromAll function to be declared as a C symbol and not mangled for C++, which fails to link later because the symbol is really provided as C++. Work around this by setting the NO_SYSTEM_FROM_IMPORTED target property on iface_test_bld. Somehow iface_test_exp does not end up with -isystem so we do not need this workaround for that target.
* install: Allow generator expressions in TARGETS DESTINATION (#14317)Brad King2015-02-114-3/+14
| | | | | | | | | | | | This will allow per-config destinations for targets in EXPORT sets. Using multiple install(TARGETS) with separate CONFIGURATIONS is rejected as a target appearing more than once in an export set. Now instead one can write install(TARGETS foo EXPORT exp DESTINATION lib/$<CONFIG>) to get a single logical membership of the target in the export set while still having a per-config destination.
* Allow export of targets with INTERFACE_SOURCES.Stephen Kelly2015-02-105-1/+52
| | | | | | Use the same rules for paths in source and binary dirs in installed INTERFACE_SOURCES as are used for INTERFACE_INCLUDE_DIRECTORIES.
* try_run: Add tests for LINK_LIBRARIES with mock libraries.Matt McCormick2015-01-261-0/+30
| | | | | Extend the ExportImport test to try using an imported library with try_run.
* install: Allow absolute EXPORT destination with relative targets (#15258)Brad King2014-12-157-0/+44
| | | | | | | | | | | | | | | | | When install(EXPORT) is given an absolute destination we cannot compute the install prefix relative to the installed export file location. Previously we disallowed installation of targets in such exports with a relative destination, but did not enforce this for target property values besides the location of the main target file. This could lead to broken installations when the EXPORT is installed to an absolute path but usage requirements are specified relative to the install prefix. Since an EXPORT installed to an absolute destination cannot be relocated we can just hard-code the value of CMAKE_INSTALL_PREFIX as the base for relative paths. This will allow absolute install(EXPORT) destinations to work with relative destinations for targets and usage requirements. Extend the ExportImport test with a case covering this behavior.
* Tests: Add generator platform supportBrad King2014-09-101-0/+2
| | | | | Propagate CMAKE_GENERATOR_PLATFORM through the test hierarchy so that all tests can build with the selected generator platform, if any.
* Features: Extend concept to C language.Stephen Kelly2014-05-142-1/+25
| | | | | | | | | | | 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: Fix name of cache variable.Stephen Kelly2014-05-071-2/+2
|
* Export: Populate INTERFACE_COMPILE_FEATURES property.Stephen Kelly2014-04-083-1/+22
|
* Tests: Rename CMAKE_TEST_MAKEPROGRAM uses for nested test projectsBrad King2014-03-032-3/+3
| | | | | | | In the ExportImport, Fortran, and MacRuntimePath tests the CMAKE_TEST_MAKEPROGRAM variable is used to pass an explicit request for a CMAKE_MAKE_PROGRAM value to be used when building the inner projects. Rename these use cases to CMake_TEST_NESTED_MAKE_PROGRAM.
* install: Support generator expressions in FILES and PROGRAMS modeBrad King2014-02-215-0/+35
| | | | | | | | Teach the install(FILES) and install(PROGRAMS) commands to evaluate generator expressions in the list of files. Extend the ExportImport test to cover installation cases involving generator expressions.
* install: Ensure that install(TARGETS) works with no DESTINATIONStephen Kelly2014-01-041-1/+4
| | | | | INTERFACE_LIBRARY targets have no corresponding files, and so require no DESTINATION to install anything to.
* export: Implement EXPORT subcommand (#9822)Stephen Kelly2013-12-241-5/+5
| | | | | | Teach the export command to handle export sets defined by invocations of install(TARGETS ... EXPORT foo). This makes maintenance of targets exported to both the build tree and install tree trivial.
* Merge topic 'cleanup-build-commands'Brad King2013-12-061-0/+3
|\ | | | | | | | | ef7c11e Tests: Fix standalone build of tests with nested projects
| * Tests: Fix standalone build of tests with nested projectsBrad King2013-12-051-0/+3
| | | | | | | | | | | | | | | | | | Since commit fd6076d0 (Tests: Pass CMAKE_MAKE_PROGRAM instead of --build-makeprogram, 2013-11-15) the ExportImport, Fortran, and MacRuntimePath tests use the value of CMAKE_TEST_MAKEPROGRAM as the CMAKE_MAKE_PROGRAM for their nested projects configurations. Teach these tests to initialize CMAKE_TEST_MAKEPROGRAM when it is not provided, such as when building the tests manually.
* | Export: Prefix relative items with genexes in INSTALL_INTERFACE.Stephen Kelly2013-11-262-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Code such as target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include$<FOO>> ) should be treated as a relative directory, despite the genex, after the INSTALL_INTERFACE is stripped away. Previously, this would generate a relative directory on export, which would be an error on import, so no policy is needed.
* | Export: Process INSTALL_INTERFACE in INCLUDES DESTINATION.Stephen Kelly2013-11-262-0/+35
| | | | | | | | | | | | | | | | | | | | Code such as install(TARGETS ... INCLUDES DESTINATION $<INSTALL_INTERFACE:include> ) should behave as if the INSTALL_INTERFACE wrapper were not present.
* | Export: Process relative includes after genex evaluation.Stephen Kelly2013-11-262-1/+17
|/ | | | | | | | | | | | | In code such as install(TARGETS ... INCLUDES DESTINATION $<FOO>include ) the generator expressions are evaluated at generate-time. Delay determining whether each entry is a relative path until after the generator expressions are evaluated. Such relative paths are based relative to the CMAKE_INSTALL_PREFIX.
* Tests: Pass CMAKE_MAKE_PROGRAM instead of --build-makeprogramBrad King2013-11-182-2/+1
| | | | | | | | | | Pass the CMAKE_TEST_MAKEPROGRAM, if any, to each test at CMake time in the CMAKE_MAKE_PROGRAM cache entry. Pass the CMAKE_TEST_MAKEPROGRAM into the ExportImport, Fortran, and MacRuntimePath tests so that they may do the same for the nested project configurations. Now "ctest --build-and-test" can get the make program from the test build tree cache, so drop the explicit --build-makeprogram.
* Consider targets with double colons to be IMPORTED or ALIAS targets.Stephen Kelly2013-10-212-11/+11
| | | | | | | | Introduce a policy to control the behavior. The AliasTargets unit test already tests that using a double-semicolon in the name is not an error. Change the ExportImport test to use a namespace with a double-semicolon too.
* Merge topic 'INTERFACE_LIBRARY-target-type'Brad King2013-10-089-0/+167
|\ | | | | | | | | | | | | ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets 435c912 export: Add support for INTERFACE_LIBRARY targets fe73226 Add the INTERFACE_LIBRARY target type.
| * install: Teach EXPORT option to handle INTERFACE_LIBRARY targetsStephen Kelly2013-10-082-0/+33
| |