summaryrefslogtreecommitdiff
path: root/Source/cmAddLibraryCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* find_package: Add support for default GLOBAL imported targetsJohn Parent2022-03-101-0/+4
| | | | | | | | | Allow find package to promote scope of imported targets by specifying an argument to `find_package` or by specifying a CMake variable. * Add support for CMAKE_GLOBAL_IMPORT_SCOPE variable * Add support for GLOBAL argument to find_package Additionally add testing for above features.
* Move helpers functions from cmStringAlgorithms.h to cmValue.hMarc Chevrier2021-09-211-0/+1
| | | | | Helpers functions related to cmValue semantic are now part of cmValue.h header.
* add_library(): Allow imported object libraries with multi-archCraig Scott2021-02-061-10/+0
| | | Fixes: #21276
* Add INTERFACE libraries to generated buildsystem if they have SOURCESBrad King2020-08-071-24/+2
| | | | | | | | | | | | | | | | | | | | | | | | INTERFACE libraries were created with the intention of collecting usage requirements for use by other targets via `target_link_libraries`. Therefore they were not allowed to have SOURCES and were not included in the generated buildsystem. In practice, this has become limiting: * Header-only libraries do have sources, they just do not compile. Developers should be able to edit those sources (the header files) in their IDE. * Header-only libraries may need to generate some of their header files via custom commands. Some projects work around these limitations by pairing each interface library with an `add_custom_target` that makes the header files and custom commands appear in the generated buildsystem and in IDEs. Lift such limitations by allowing INTERFACE libraries to have SOURCES. For those with sources, add a corresponding build target to the generated buildsystem. Fixes: #19145
* add_library/add_executable: allow local alias to imported targetsMarc Chevrier2020-06-021-8/+3
| | | | Fixes: #20641
* ALIAS target: cannot overwrite an existing targetMarc Chevrier2020-05-281-0/+11
| | | | Fixes: #19616
* Refactoring: use append functions from cmext/algorithmMarc Chevrier2019-12-171-2/+3
|
* Refactor: Use cmStrCat to construct error stringsAsit Dhal2019-09-181-36/+26
| | | | | Replace string construction using std::stringstream with cmStrCat and cmWrap.
* clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-1/+1
| | | | | | Set the MinTypeNameLength option to an impossibly high value in order to limit the diagnostics to iterators. Leave new expressions and cast expressions for later.
* Source sweep: Replace std::ostringstream when used with a single appendSebastian Holtermann2019-08-231-42/+26
| | | | | | | This replaces `std::ostringstream`, when it is written to only once. If the single written argument was numeric, `std::to_string` is used instead. Otherwise, the single written argument is used directly instead of the `std::ostringstream::str()` invocation.
* Source sweep: Use cmIsOn instead of cmSystemTools::IsOnSebastian Holtermann2019-08-171-2/+2
| | | | | | | | | This replaces invocations of - `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn` - `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND` - `cmSystemTools::IsOn` with `cmIsOn` - `cmSystemTools::IsOff` with `cmIsOff`
* cmA*Command: Turn into free functionsRegina Pfeifer2019-08-071-52/+48
| | | | Ref: #19499
* Use cmAppend to append ranges to std::vector instancesSebastian Holtermann2019-05-231-1/+2
|
* add_library: Now support aliasing unknown import targetsRobert Maynard2019-03-261-1/+3
| | | | Fixes #18327
* Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-4/+4
| | | | Reduce the number of files relying on `cmake.h`.
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-2/+3
| | | | | | | | | | | | 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_library: Restore error on alias of non-global imported targetBrad King2018-05-101-0/+8
| | | | | | | | | | | In commit v3.11.0-rc1~433^2~1 (Add support for IMPORTED GLOBAL targets to be aliased, 2017-09-14) we accidentally dropped the error on calling `add_library` to alias an imported target that is not globally visible. The `add_executable` command's equivalent check was properly updated. Restore the check in `add_library` with the same update. Also fix the test case accordingly. Fixes: #17982
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-1/+1
| | | | | | | | | | * Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
* Merge topic 'cmp0037-conditional-targets'Brad King2017-10-311-30/+2
|\ | | | | | | | | | | | | | | | | | | | | | | ae5f4069 CMP0037: Allow test and package targets when features are not enabled 409527a0 CMP0037: De-duplicate check and message generation a2611d81 Tests: Add RunCMake.CMP0037 case for WARN on reserved targets 103501c4 Tests: Do not enable languages in all cases of RunCMake.CMP0037 2d0b3e6e cmGlobalGenerator: Refactor test and package target conditions Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !1417
| * CMP0037: De-duplicate check and message generationBrad King2017-10-301-30/+2
| |
* | Add support for IMPORTED GLOBAL targets to be aliasedDeniz Bahadir2017-10-261-7/+0
|/ | | | | Issue: #15569 Issue: #17197
* Defer check for sources within a target until generation.Deniz Bahadir2017-10-241-8/+0
| | | | | | | | | | | | | | | The `add_library` and `add_executable` commands can now be called with no source-files and won't generate a warning or error message, as long as source-files will be added later via the `target_sources` command. If during the generation step still no sources are associated with targets created by such calls a useful error message will be generated and generation fails. Targets of type `INTERFACE_LIBRARY`, `UTILITY` or `GLOBAL_TARGET` are excluded from this check because we do not need sources for these target types during generation. Fixes: #16872
* Add const-reference qualificationsPavel Solodovnikov2017-05-261-1/+1
|
* Allow OBJECT libraries to be installed, exported, and importedRobert Maynard2017-04-181-4/+9
| | | | | | | | 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>
* clang-tidy: apply performance-faster-string-find fixesDaniel Pfeifer2016-12-121-1/+1
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-0/+8
|
* Fix newly discovered clang-tidy issuesDaniel Pfeifer2016-10-211-2/+2
| | | | | | | Clang-tidy reports some issues only from the currently compiled source file and its associated header file. Separating the compilation of commands exposed some clang-tidy issues that were not reported previously. Fix them.
* Separate compilation for commands included in cmBootstrapCommands1Daniel Pfeifer2016-10-211-0/+2
|
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-31/+32
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* use empty method to check for emptynessDaniel Pfeifer2016-09-151-1/+1
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-207/+132
| | | | | | | | | | | | | 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-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* cmTarget: Implement ALIAS in terms of name mappingStephen Kelly2015-10-271-1/+1
| | | | Remove mapping to cmTarget.
* cmState: Move TargetType enum from cmTarget.Stephen Kelly2015-10-151-32/+32
| | | | | | | Mostly automated: values=( "EXECUTABLE" "STATIC_LIBRARY" "SHARED_LIBRARY" "MODULE_LIBRARY" "OBJECT_LIBRARY" "UTILITY" "GLOBAL_TARGET" "INTERFACE_LIBRARY" "UNKNOWN_LIBRARY" "TargetType") for i in "${values[@]}"; do git grep -l cmTarget::$i | xargs sed -i "s|cmTarget::$i|cmState::$i|g"; done
* Port to static cmPolicies API.Stephen Kelly2015-05-041-2/+1
|
* Port Global property interaction to cmState.Stephen Kelly2015-04-151-1/+2
|
* Convert while loop to member insert.Stephen Kelly2015-02-061-5/+1
|
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-23/+23
| | | | All compilers hosting CMake support the std class.
* add_library: Fix target type check for non-shared-lib platformsBrad King2014-12-031-3/+2
| | | | | | | | | | | | When checking target types for TARGET_SUPPORTS_SHARED_LIBS == false, enumerate exactly the library types not supported rather than trying to maintain a list of all the types that are supported. Otherwise add_library(SomeImportedLib UNKNOWN IMPORTED) warns on platforms that do not support shared libraries. Reported-by: Kelly Thompson <kgt@lanl.gov>
* Merge topic 'fix_policy_diagnostics'Brad King2014-04-011-4/+7
|\ | | | | | | | | 77b581c2 Policies: omit warnings about unset policies when they are actually set to NEW
| * Policies: omit warnings about unset policies when they are actually set to NEWNils Gladitz2014-03-311-4/+7
| |
* | Remove some c_str() calls.Stephen Kelly2014-03-111-29/+29
|/ | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* add_library: Issue better diagnostic for INTERFACE GLOBAL signature.Stephen Kelly2014-02-071-0/+7
|
* cmMakefile: make some methods take const std::string& instead of const char*Rolf Eike Beer2014-01-161-1/+1
| | | | | | | | Most callers already have a std::string, on which they called c_str() to pass it into these methods, which internally converted it back to std::string. Pass a std::string directly to these methods now, avoiding all these conversions. Those methods that only pass in a const char* will get the conversion to std::string now only once.
* add_library: Disallow invalid signatures for INTERFACE_LIBRARY.Stephen Kelly2014-01-061-0/+88
| | | | | Document the valid signatures. Add a test for the IMPORTED GLOBAL signature.
* CMP0037: Extend policy to reserved names and custom targetsNils Gladitz2013-11-191-2/+5
| | | | | | | | Teach add_custom_target to check the policy too. Extend the policy to disallow reserved target names that we use for builtin targets like "all". Extend the RunCMake.CMP0037 test to cover these cases.
* add_library: Fix INTERFACE on platforms with no shared libs (#14561)Stephen Kelly2013-11-121-0/+1
|