Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: CMakeLists.txt: add install rules #196

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
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 @@
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})
Comment on lines +120 to +123
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I'm surprised to see this, given that the documentation claims "include" is the default/fallback value for the variable: https://cmake.org/cmake/help/latest/command/install.html#signatures


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")
Loading