Skip to content

Commit

Permalink
CMakeLists.txt: add install rules
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneSerge committed Apr 12, 2024
1 parent 8563e16 commit ff20336
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
35 changes: 34 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ target_sources(imnodes PRIVATE
imnodes.h
imnodes_internal.h
imnodes.cpp)
target_include_directories(imnodes PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(
imnodes PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(imnodes PUBLIC ${IMNODES_IMGUI_TARGET_NAME})

# Example projects
Expand Down Expand Up @@ -105,3 +107,34 @@ if(IMNODES_EXAMPLES)
target_link_libraries(hello X11 Xext GL)
endif()
endif()

install(
TARGETS imnodes
EXPORT imnodes_target
ARCHIVE COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY COMPONENT Runtime
NAMELINK_COMPONENT Development
DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME COMPONENT Runtime DESTINATION ${CMAKE_INSTALL_BINDIR})

install(

Check failure on line 120 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / build (macos-latest)

install FILES given no DESTINATION!

Check failure on line 120 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / build (windows-latest)

install FILES given no DESTINATION!
FILES imnodes.h imnodes_internal.h
COMPONENT Development
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

include(CMakePackageConfigHelpers)
configure_package_config_file(
Config.cmake.in imnodes-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/imnodes)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/imnodes-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/imnodes)

install(
EXPORT imnodes_target
NAMESPACE imnodes::
FILE imnodes-targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/imnodes)

if(IMNODES_EXAMPLES)
install(TARGETS saveload hello RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
1 change: 1 addition & 0 deletions Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/imnodes-targets.cmake")

0 comments on commit ff20336

Please sign in to comment.