Skip to content

Commit

Permalink
Link gtest against static cascade
Browse files Browse the repository at this point in the history
  • Loading branch information
marcromani committed Mar 26, 2024
1 parent 870f13a commit 27b24c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
22 changes: 15 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,27 @@ set(SOURCES
util.cpp
var.cpp)

add_library(cascade_static STATIC ${SOURCES})
set_target_properties(cascade_static PROPERTIES OUTPUT_NAME cascade)
target_include_directories(cascade_static
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

if(BUILD_SHARED)
add_library(cascade SHARED ${SOURCES})
else()
add_library(cascade STATIC ${SOURCES})
set_target_properties(cascade PROPERTIES OUTPUT_NAME cascade)
target_include_directories(cascade PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
endif()

set_target_properties(cascade PROPERTIES OUTPUT_NAME cascade)

target_include_directories(cascade PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

install(
TARGETS cascade
TARGETS cascade_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

if(TARGET cascade)
install(
TARGETS cascade
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()

install(FILES ${HEADERS} DESTINATION include)
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ set(gtest_force_shared_crt
ON
CACHE BOOL "" FORCE)

set(build_gmock
set(BUILD_GMOCK
OFF
CACHE BOOL "" FORCE)

set(install_gtest
set(INSTALL_GTEST
OFF
CACHE BOOL "" FORCE)

Expand All @@ -30,7 +30,7 @@ enable_testing()

target_include_directories(run_tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

target_link_libraries(run_tests cascade GTest::gtest_main)
target_link_libraries(run_tests cascade_static GTest::gtest_main)

include(GoogleTest)
gtest_discover_tests(run_tests)
Expand Down

0 comments on commit 27b24c4

Please sign in to comment.