Fix cmake from being over-dynamic
This commit is contained in:
parent
796d04a4f4
commit
4c0fc7228b
|
@ -7,7 +7,7 @@ enable_testing()
|
|||
|
||||
|
||||
# define library
|
||||
add_library(${PROJECT_NAME} STATIC src/test_static_library.c include/test_static_library.h)
|
||||
add_library(test_static_library STATIC src/test_static_library.c include/test_static_library.h)
|
||||
|
||||
# library properties and meta vars
|
||||
set_target_properties(test_static_library PROPERTIES
|
||||
|
@ -22,10 +22,10 @@ target_include_directories(${PROJECT_NAME} PUBLIC
|
|||
|
||||
|
||||
# pkg-config props
|
||||
configure_file(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
|
||||
configure_file(test_static_library.pc.in test_static_library.pc @ONLY)
|
||||
|
||||
# export native cmake package
|
||||
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config
|
||||
install(TARGETS test_static_library EXPORT test_static_libraryConfig
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
|
@ -34,19 +34,19 @@ install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc
|
|||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
|
||||
|
||||
# install exported packages
|
||||
install(EXPORT ${PROJECT_NAME}Config DESTINATION share/${PROJECT_NAME}/cmake)
|
||||
export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}Config.cmake)
|
||||
|
||||
install(EXPORT test_static_libraryConfig DESTINATION share/${PROJECT_NAME}/cmake)
|
||||
export(TARGETS test_static_library FILE test_static_libraryConfig.cmake)
|
||||
|
||||
|
||||
message(STATUS "${CMAKE_C_FLAGS}")
|
||||
|
||||
# test executable
|
||||
add_executable(test_library test.c)
|
||||
target_link_libraries(test_library ${PROJECT_NAME})
|
||||
target_link_libraries(test_library test_static_library)
|
||||
|
||||
# testing support with make test
|
||||
add_test(test_shared_lib_dynamic test_library)
|
||||
add_test(test_static test_library)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user