Commit 0158e2f8 authored by Matthias Braun's avatar Matthias Braun
Browse files

Update cmake export/config stuff

parent de252364
...@@ -478,7 +478,7 @@ set(INSTALL_HEADERS ...@@ -478,7 +478,7 @@ set(INSTALL_HEADERS
) )
install(TARGETS firm install(TARGETS firm
EXPORT libfirm EXPORT libfirmTargets
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
) )
...@@ -488,25 +488,35 @@ foreach(header ${INSTALL_HEADERS}) ...@@ -488,25 +488,35 @@ foreach(header ${INSTALL_HEADERS})
endforeach(header) endforeach(header)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gen/include/libfirm/nodes.h DESTINATION include/libfirm) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gen/include/libfirm/nodes.h DESTINATION include/libfirm)
# Generate cmake configuration that external projects can include # Generate cmake Config file
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libfirm-config.cmake include(CMakePackageConfigHelpers)
"add_library(firm SHARED IMPORTED) set(libfirm_INCLUDE_DIRS include)
find_library(FIRM_LIBRARY_PATH firm) set(ConfigPackageLocation lib/cmake/libfirm)
set_target_properties(firm PROPERTIES IMPORTED_LOCATION \"\${FIRM_LIBRARY_PATH}\")" configure_package_config_file(support/libfirmConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libfirmConfig.cmake
INSTALL_DESTINATION ${ConfigPackageLocation}
PATH_VARS libfirm_INCLUDE_DIRS
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/libfirmConfigVersion.cmake
VERSION ${libfirm_VERSION}
COMPATIBILITY ExactVersion
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libfirmConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/libfirmConfigVersion.cmake
DESTINATION ${ConfigPackageLocation}
)
install(EXPORT libfirmTargets
FILE libfirmTargets.cmake
NAMESPACE libfirm::
DESTINATION ${ConfigPackageLocation}
) )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libfirm-config.cmake DESTINATION lib/cmake/libfirm)
# Generate pkg-config for external projects # Generate pkg-config for external projects
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libfirm.pc configure_file(${CMAKE_CURRENT_SOURCE_DIR}/support/libfirm.pc.in
"prefix=${CMAKE_INSTALL_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/libfirm.pc
libdir=\${prefix}/lib @ONLY
includedir=\${prefix}/include )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libfirm.pc"
Name: ${PROJECT_NAME} DESTINATION lib/pkgconfig
Description: ${PROJECT_DESCRIPTION}
Version: ${PROJECT_VERSION}
Requires:
Libs: -L\${libfir} -lfirm -lm
Cflags: -I\${includedir}"
) )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libfirm.pc" DESTINATION lib/pkgconfig)
prefix=@CMAKE_INSTALL_PREFIX@
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Requires:
Libs: -L${prefix}/lib -lfirm -lm
Cflags: -I${prefix}/include
@PACKAGE_INIT@
set(libfirm_VERSION_MAJOR "@libfirm_VERSION_MAJOR@")
set(libfirm_VERSION_MINOR "@libfirm_VERSION_MINOR@")
set(libfirm_VERSION_PATCH "@libfirm_VERSION_PATCH@")
set_and_check(libfirm_INCLUDE_DIRS "@PACKAGE_libfirm_INCLUDE_DIRS@")
include("${CMAKE_CURRENT_LIST_DIR}/libfirmTargets.cmake")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment