MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0014317 | CMake | CMake | public | 2013-07-26 04:43 | 2015-07-08 08:57 |
Reporter | Fabian Saccilotto | ||||
Assigned To | Brad King | ||||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Visual Studio 2010 | OS | Windows | OS Version | 8 |
Product Version | CMake 2.8.11.2 | ||||
Target Version | CMake 3.3 | Fixed in Version | CMake 3.3 | ||
Summary | 0014317: Configuration dependent install EXPORT | ||||
Description | Commands INSTALL(TARGETS ... EXPORT INSTALL(EXPORT Installing exported libraries to configuration dependent folder doesn't work at the moment. Because of the fact that *-targets-<configuration>.cmake files are generated during execution of CMake for the library to export, they contain paths with ${BUILD_TYPE}. During the find_package() stage of the parent project this variable will be empty and therefore an error occurs that the file can't be found. Extract from *-targets-debug.cmake set_target_properties(sba PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "blas;lapack;f2c" IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/1.6/lib/${BUILD_TYPE}/sba.lib" ) | ||||
Steps To Reproduce | Install a library to a configuration dependent folder and install the export. See the following CMakeLists.txt snippet. # Snippet from CMakeLists.txt ----------------------------------- add_library(<libname> <sources>) # Export for later reuse set(PACKAGE_NAME <packagename>) set(VERSION <version>) # Make a directory for each config install(TARGETS <libname> EXPORT ${PACKAGE_NAME}-targets RUNTIME DESTINATION ${VERSION}/bin/\${BUILD_TYPE} COMPONENT Runtime LIBRARY DESTINATION ${VERSION}/lib/\${BUILD_TYPE} COMPONENT Runtime ARCHIVE DESTINATION ${VERSION}/lib/\${BUILD_TYPE} COMPONENT Development} ) configure_file( ${${PROJECT_NAME}_SOURCE_DIR}/${PACKAGE_NAME}-config.cmake.in ${${PROJECT_NAME}_BINARY_DIR}/${PACKAGE_NAME}-config.cmake @ONLY ) configure_file( ${${PROJECT_NAME}_SOURCE_DIR}/${PACKAGE_NAME}-config-version.cmake.in ${${PROJECT_NAME}_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake @ONLY ) install(FILES ${${PROJECT_NAME}_BINARY_DIR}/${PACKAGE_NAME}-config.cmake ${${PROJECT_NAME}_BINARY_DIR}/${PACKAGE_NAME}-config.cmake DESTINATION ${VERSION} ) install(EXPORT ${PACKAGE_NAME}-targets DESTINATION ${VERSION}) # *-config.cmake.in --------------------------------------- # Import the targets get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${SELF_DIR}/@PACKAGE_NAME@-targets.cmake) | ||||
Additional Information | My proposal to add this feature: The ${BUILD_TYPE} Variable could be set in the *-targets-<configuration>.cmake file during creation of the files as the configuration is known. I implemented the code on the source of 2.8.11.2 tag of the git repository and made a patch. In cmExportFileGenerator::GenerateImportHeaderCode the BUILD_TYPE variable is set if a configuration is available. This allows users to use that variable in install paths. //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const char* config) { os << "#----------------------------------------------------------------\n" << "# Generated CMake target import file"; if(config) { os << " for configuration \"" << config << "\".\n"; } else { os << ".\n"; } os << "#----------------------------------------------------------------\n" << "\n"; this->GenerateImportConfigurationCode(os, config); this->GenerateImportVersionCode(os); } //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportConfigurationCode(std::ostream& os, const char* config) { // Store the used configuration, this will allow configuration dependent // paths in multi-configuration environments if(config) { os << "# Set configuration for use in paths.\n" << "set(BUILD_TYPE " << config << ")\n" << "\n"; } } | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | config_dependent_install.patch (2,365) 2013-07-26 04:43 https://public.kitware.com/Bug/file/4827/config_dependent_install.patch generator_expressions.patch (4,331) 2013-11-28 08:59 https://public.kitware.com/Bug/file/4985/generator_expressions.patch | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2013-07-26 04:43 | Fabian Saccilotto | New Issue | |||
2013-07-26 04:43 | Fabian Saccilotto | File Added: config_dependent_install.patch | |||
2013-07-29 11:06 | Brad King | Note Added: 0033625 | |||
2013-07-29 11:06 | Brad King | Status | new => backlog | ||
2013-07-29 11:08 | Brad King | Note Added: 0033626 | |||
2013-11-28 08:59 | Dominik Bernhardt | File Added: generator_expressions.patch | |||
2013-11-28 09:01 | Dominik Bernhardt | Note Added: 0034610 | |||
2013-12-02 09:06 | Brad King | Assigned To | => Stephen Kelly | ||
2013-12-02 09:06 | Brad King | Status | backlog => assigned | ||
2013-12-02 09:06 | Brad King | Note Added: 0034663 | |||
2013-12-02 11:07 | Stephen Kelly | Note Added: 0034677 | |||
2013-12-04 12:21 | Stephen Kelly | Status | assigned => backlog | ||
2013-12-04 12:21 | Stephen Kelly | Assigned To | Stephen Kelly => | ||
2015-02-12 12:57 | Brad King | Note Added: 0037959 | |||
2015-02-12 12:58 | Brad King | Assigned To | => Brad King | ||
2015-02-12 12:58 | Brad King | Status | backlog => resolved | ||
2015-02-12 12:58 | Brad King | Resolution | open => fixed | ||
2015-02-12 12:58 | Brad King | Fixed in Version | => CMake 3.3 | ||
2015-02-12 12:58 | Brad King | Target Version | => CMake 3.3 | ||
2015-07-08 08:57 | Robert Maynard | Note Added: 0039049 | |||
2015-07-08 08:57 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|