summaryrefslogtreecommitdiffstats
path: root/Source/cmAddLibraryCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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-141-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
|
* Disallow invalid target names (#13140)Stephen Kelly2013-11-071-0/+39
| | | | | Exclude Borland and NMake from the CMP0037 test. They do not accept the colon in a target name.
* export: Add support for INTERFACE_LIBRARY targetsStephen Kelly2013-10-081-0/+10
|
* Add the INTERFACE_LIBRARY target type.Stephen Kelly2013-10-071-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | This target type only contains INTERFACE_* properties, so it can be used as a structural node. The target-specific commands enforce that they may only be used with the INTERFACE keyword when used with INTERFACE_LIBRARY targets. The old-style target properties matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for this target type. The name of the INTERFACE_LIBRARY must match a validity generator expression. The validity is similar to that of an ALIAS target, but with the additional restriction that it may not contain double colons. Double colons will carry the meaning of IMPORTED or ALIAS targets in CMake 2.8.13. An ALIAS target may be created for an INTERFACE library. At this point it can not be exported and does not appear in the buildsystem and project files are not created for them. That may be added as a feature in a later commit. The generators need some changes to handle the INTERFACE_LIBRARY targets returned by cmComputeLinkInterface::GetItems. The Ninja generator does not use that API, so it doesn't require changes related to that.
* Add the ALIAS target concept for libraries and executables.Stephen Kelly2013-08-021-0/+80
| | | | | | | | | | | | | | | | | * The ALIAS name must match a validity regex. * Executables and libraries may be aliased. * An ALIAS acts immutable. It can not be used as the lhs of target_link_libraries or other commands. * An ALIAS can be used with add_custom_command, add_custom_target, and add_test in the same way regular targets can. * The target of an ALIAS can be retrieved with the ALIASED_TARGET target property. * An ALIAS does not appear in the generated buildsystem. It is kept separate from cmMakefile::Targets for that reason. * A target may have multiple aliases. * An ALIAS target may not itself have an alias. * An IMPORTED target may not have an alias. * An ALIAS may not be exported or imported.
* add_library: Allow OBJECT library without dynamic linking (#13289)Brad King2012-06-111-7/+8
| | | | | | | When global property TARGET_SUPPORTS_SHARED_LIBS is FALSE we should still allow OBJECT libraries. This was an oversight in commit b87d7a60 (Add OBJECT_LIBRARY target type, 2012-03-12). While at it, fix the warning message to report context.
* Add OBJECT_LIBRARY target typeBrad King2012-03-131-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | This library type can compile sources to object files but does not link or archive them. It will be useful to reference from executable and normal library targets for direct inclusion of object files in them. Diagnose and reject the following as errors: * An OBJECT library may not be referenced in target_link_libraries. * An OBJECT library may contain only compiling sources and supporting headers and custom commands. Other source types that are not normally ignored are not allowed. * An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands. * An OBJECT library may not be installed, exported, or imported. Some of these cases may be supported in the future but are not for now. Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior.
* Optionally allow IMPORTED targets to be globally visibleBrad King2012-01-251-1/+7
| | | | | | | | | | | | Consider the case motivating commit e01cce28 (Allow add_dependencies() on imported targets, 2010-11-19). An imported target references a file generated at build time by a custom target on which it depends. Had the file been built directly using add_library or add_executable its target name would have been visible globally. Therefore the imported target representing the file should be globally visible also. Teach the IMPORTED signature of add_(executable|library) to accept a new "GLOBAL" option to make the imported target visible globally.
* Move automoc processing from add_executable/library to cmGlobalGeneratorAlex Neundorf2011-08-151-22/+1
| | | | | | | Now automoc is enabled by setting the AUTOMOC target property to true, instead of using the AUTOMOC keyword in add_executable() or add_library() Alex
* Refactor SetupAutomocTarget() so it can be run after creating the targetAlex Neundorf2011-08-151-11/+3
| | | | | | | This makes it easier to move it from InitialPass() to some other location, e.g. FinalPass() or something else. Alex
* Remove trailing whitespaceAlex Neundorf2011-08-151-6/+6
| | | | Alex
* Add AUTOMOC to the add_library() commandAlex Neundorf2011-08-141-11/+39
| | | | Alex
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | This converts the CMake license to a pure 3-clause OSI-approved BSD License. We drop the previous license clause requiring modified versions to be plainly marked. We also update the CMake copyright to cover the full development time range.
* ENH: Add UNKNOWN type for IMPORTED librariesBrad King2008-08-181-0/+16
| | | | | | | | | | | | | | | When creating an IMPORTED target for a library that has been found on disk, it may not be known whether the library is STATIC or SHARED. However, the library may still be linked using the file found from disk. Use of an IMPORTED target is still important to allow per-configuration files to be specified for the library. This change creates an UNKNOWN type for IMPORTED library targets. The IMPORTED_LOCATION property (and its per-config equivalents) specifies the location of the library. CMake makes no assumptions about the library that cannot be inferred from the file on disk. This will help projects and find-modules import targets found on disk or specified by the user.
* COMP: Fix shadowed local variable warning.Brad King2008-02-111-0/+2
|
* ENH: Enforce global target name uniqueness.Brad King2008-02-111-16/+8
| | | | | | | | - Error if imported target is involved in conflict - Error for non-imported target conflict unless CMAKE_BACKWARDS_COMPATIBILITY <= 2.4 - Include OUTPUT_NAME property in error message - Update add_executable and add_library command documentation
* ENH: Updated exporting and importing of targets to support libraries and ↵Brad King2008-01-281-3/+42
| | | | | | | | | | | | | | | | | | configurations. - Created cmExportFileGenerator hierarchy to implement export file generation - Installed exports use per-config import files loaded by a central one. - Include soname of shared libraries in import information - Renamed PREFIX to NAMESPACE in INSTALL(EXPORT) and EXPORT() commands - Move addition of CMAKE_INSTALL_PREFIX to destinations to install generators - Import files compute the installation prefix relative to their location when loaded - Add mapping of importer configurations to importee configurations - Rename IMPORT targets to IMPORTED targets to distinguish from windows import libraries - Scope IMPORTED targets within directories to isolate them - Place all properties created by import files in the IMPORTED namespace - Document INSTALL(EXPORT) and EXPORT() commands. - Document IMPORTED signature of add_executable and add_library - Enable finding of imported targets in cmComputeLinkDepends
* ENH: add return and break support to cmake, also change basic command ↵Ken Martin2008-01-231-1/+2
| | | | invocation signature to be able to return extra informaiton via the cmExecutionStatus class
* STYLE: better error message, name the new manpages cmakecommands,Alexander Neundorf2007-07-131-3/+4
| | | | | | cmakecompat, cmakeprops and cmakemodules Alex