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

[CMake] Restore old way of importing Notcurses into a cmake project #1149

Merged
merged 1 commit into from
Nov 29, 2020
Merged
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
41 changes: 17 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,61 +592,54 @@ configure_file(tools/notcurses++.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
@ONLY
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
DESTINATION ${PKGCONFIG_DIR}
)

include(CMakePackageConfigHelpers)
configure_file(tools/version.h.in include/version.h)
configure_file(tools/builddef.h.in include/builddef.h)

configure_package_config_file(tools/NotcursesConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/NotcursesConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/notcurses/cmake
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/NotcursesConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)

configure_package_config_file(tools/Notcurses++Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/Notcurses++Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/notcurses/cmake
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/Notcurses++ConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)

# Installation
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/NotcursesConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NotcursesConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses"
)

install(TARGETS notcurses
EXPORT "NotcursesTargets"
)

install(EXPORT "NotcursesTargets"
NAMESPACE "notcurses::"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses"
FILE "NotcursesConfig.cmake"
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/Notcurses++Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Notcurses++ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses++"
)

install(TARGETS notcurses++
EXPORT "Notcurses++Targets"
)

install(EXPORT "Notcurses++Targets"
NAMESPACE "notcurses++::"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses++"
FILE "Notcurses++Config.cmake"
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
DESTINATION ${PKGCONFIG_DIR}
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
DESTINATION ${PKGCONFIG_DIR}
)

if(${USE_FFMPEG} OR ${USE_OIIO})
file(GLOB TESTDATA CONFIGURE_DEPENDS data/*)
# Don't install source materia for self-originated multimedia
Expand Down
9 changes: 9 additions & 0 deletions tools/Notcurses++Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@
set(Notcurses++_DIR "@PACKAGE_SOME_INSTALL_DIR@")

# Compute paths
get_filename_component(Notcurses_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(Notcurses++_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
set(Notcurses++_LIBRARY_DIRS "@CONF_LIBRARY_DIRS@")

set(Notcurses++_LIBRARIES -lnotcurses -lnotcurses++)
9 changes: 9 additions & 0 deletions tools/NotcursesConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@
set(Notcurses_DIR "@PACKAGE_SOME_INSTALL_DIR@")

# Compute paths
get_filename_component(Notcurses_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(Notcurses_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
set(Notcurses_LIBRARY_DIRS "@CONF_LIBRARY_DIRS@")

set(Notcurses_LIBRARIES -lnotcurses)