From 4c0fc7228b0d6f07e96ef288533039b059a48bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Mon, 18 May 2020 13:22:03 +0200 Subject: [PATCH] Fix cmake from being over-dynamic --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a12ce4..86c60b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) +