diff options
author | Brad King <brad.king@kitware.com> | 2019-07-16 14:28:44 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-07-16 14:28:54 (GMT) |
commit | 76a540bab5f05e4d523ce1b0480b0ee6424c676b (patch) | |
tree | 41848e8c05bc5ac200b4b642a52dfaec592624fc | |
parent | 09b4dfb92aab0b13d3df70ff974d4208386d55f0 (diff) | |
parent | 84ddeb8fa50cf16c53a48d1ccb92d067ed973d14 (diff) | |
download | CMake-76a540bab5f05e4d523ce1b0480b0ee6424c676b.zip CMake-76a540bab5f05e4d523ce1b0480b0ee6424c676b.tar.gz CMake-76a540bab5f05e4d523ce1b0480b0ee6424c676b.tar.bz2 |
Merge topic 'doc-ENABLE_EXPORTS'
84ddeb8fa5 Help: Clarify ENABLE_EXPORTS per-platform link behavior
e29ccfcafb Help: Simplify CMAKE_ENABLE_EXPORTS documentation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3560
-rw-r--r-- | Help/prop_tgt/ENABLE_EXPORTS.rst | 23 | ||||
-rw-r--r-- | Help/variable/CMAKE_ENABLE_EXPORTS.rst | 22 |
2 files changed, 18 insertions, 27 deletions
diff --git a/Help/prop_tgt/ENABLE_EXPORTS.rst b/Help/prop_tgt/ENABLE_EXPORTS.rst index 581c2b9..daef78b 100644 --- a/Help/prop_tgt/ENABLE_EXPORTS.rst +++ b/Help/prop_tgt/ENABLE_EXPORTS.rst @@ -7,16 +7,21 @@ Normally an executable does not export any symbols because it is the final program. It is possible for an executable to export symbols to be used by loadable modules. When this property is set to true CMake will allow other targets to "link" to the executable with the -:command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level +:command:`target_link_libraries` command. On all platforms a target-level dependency on the executable is created for targets that link to it. -For DLL platforms an import library will be created for the exported -symbols and then used for linking. All Windows-based systems -including Cygwin are DLL platforms. For non-DLL platforms that -require all symbols to be resolved at link time, such as macOS, the -module will "link" to the executable using a flag like -``-bundle_loader``. For other non-DLL platforms the link rule is simply -ignored since the dynamic loader will automatically bind symbols when -the module is loaded. +Handling of the executable on the link lines of the loadable modules +varies by platform: + +* On Windows-based systems (including Cygwin) an "import library" is + created along with the executable to list the exported symbols. + Loadable modules link to the import library to get the symbols. + +* On macOS, loadable modules link to the executable itself using the + ``-bundle_loader`` flag. + +* On other platforms, loadable modules are simply linked without + referencing the executable since the dynamic loader will + automatically bind symbols when the module is loaded. This property is initialized by the value of the variable :variable:`CMAKE_ENABLE_EXPORTS` if it is set when a target is created. diff --git a/Help/variable/CMAKE_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_ENABLE_EXPORTS.rst index 7ec4d63..8848da1 100644 --- a/Help/variable/CMAKE_ENABLE_EXPORTS.rst +++ b/Help/variable/CMAKE_ENABLE_EXPORTS.rst @@ -1,22 +1,8 @@ CMAKE_ENABLE_EXPORTS -------------------- -Specify whether an executable exports symbols for loadable modules. +Specify whether executables export symbols for loadable modules. -Normally an executable does not export any symbols because it is the -final program. It is possible for an executable to export symbols to -be used by loadable modules. When this property is set to true CMake -will allow other targets to ``link`` to the executable with the -:command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level -dependency on the executable is created for targets that link to it. -For DLL platforms an import library will be created for the exported -symbols and then used for linking. All Windows-based systems -including Cygwin are DLL platforms. For non-DLL platforms that -require all symbols to be resolved at link time, such as macOS, the -module will ``link`` to the executable using a flag like -``-bundle_loader``. For other non-DLL platforms the link rule is simply -ignored since the dynamic loader will automatically bind symbols when -the module is loaded. - -This variable is used to initialize the target property -:prop_tgt:`ENABLE_EXPORTS` for executable targets. +This variable is used to initialize the :prop_tgt:`ENABLE_EXPORTS` target +property for executable targets when they are created by calls to the +:command:`add_executable` command. See the property documentation for details. |