[CMake] make BUILD_FFI_LIBRARY actually govern work/installation #2519

This commit is contained in:
nick black 2022-01-02 18:37:27 -05:00
parent 9d8cc0d86c
commit 3f99e121a3
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -411,6 +411,7 @@ endif()
####################################### #######################################
# libnotcurses-ffi (ffi shared library) # libnotcurses-ffi (ffi shared library)
if(${BUILD_FFI_LIBRARY})
file(GLOB NCFFISRCS CONFIGURE_DEPENDS src/libffi/*.c src/libffi/*.cpp) file(GLOB NCFFISRCS CONFIGURE_DEPENDS src/libffi/*.c src/libffi/*.cpp)
add_library(notcurses-ffi SHARED ${NCFFISRCS}) add_library(notcurses-ffi SHARED ${NCFFISRCS})
target_compile_options(notcurses-ffi PUBLIC -fkeep-inline-functions) target_compile_options(notcurses-ffi PUBLIC -fkeep-inline-functions)
@ -454,13 +455,13 @@ target_link_libraries(notcurses-ffi
"${LIBRT}" "${LIBRT}"
) )
target_link_directories(notcurses-ffi target_link_directories(notcurses-ffi
PRIVATE PRIVATE
"${TERMINFO_LIBRARY_DIRS}" "${TERMINFO_LIBRARY_DIRS}"
"${libdeflate_LIBRARY_DIRS}" "${libdeflate_LIBRARY_DIRS}"
"${ZLIB_LIBRARY_DIRS}" "${ZLIB_LIBRARY_DIRS}"
) )
endif()
############################################################################ ############################################################################
if(${USE_CXX}) if(${USE_CXX})
@ -992,6 +993,8 @@ configure_file(tools/notcurses.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc ${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
@ONLY @ONLY
) )
if(${BUILD_FFI_LIBRARY})
configure_file(tools/notcurses-ffi.pc.in configure_file(tools/notcurses-ffi.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses-ffi.pc ${CMAKE_CURRENT_BINARY_DIR}/notcurses-ffi.pc
@ONLY @ONLY
@ -1000,6 +1003,7 @@ configure_file(tools/notcurses++.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc ${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
@ONLY @ONLY
) )
endif()
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
configure_file(tools/version.h.in include/version.h) configure_file(tools/version.h.in include/version.h)
@ -1064,10 +1068,12 @@ install(FILES
DESTINATION ${PKGCONFIG_DIR} DESTINATION ${PKGCONFIG_DIR}
) )
if(${BUILD_FFI_LIBRARY})
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses-ffi.pc ${CMAKE_CURRENT_BINARY_DIR}/notcurses-ffi.pc
DESTINATION ${PKGCONFIG_DIR} DESTINATION ${PKGCONFIG_DIR}
) )
endif()
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc ${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
@ -1105,7 +1111,9 @@ endif()
endif() endif()
endif() # BUILD_EXECUTABLES endif() # BUILD_EXECUTABLES
if(${BUILD_FFI_LIBRARY})
LIST(APPEND INSTLIBS notcurses-core notcurses notcurses-ffi) LIST(APPEND INSTLIBS notcurses-core notcurses notcurses-ffi)
endif()
if(${USE_STATIC}) if(${USE_STATIC})
LIST(APPEND INSTLIBS notcurses-core-static notcurses-static) LIST(APPEND INSTLIBS notcurses-core-static notcurses-static)
endif() endif()