Skip to content

Commit

Permalink
autotest/cpp/CMakeLists.txt: avoid reompiling main_gtest.cpp muliple …
Browse files Browse the repository at this point in the history
…times
  • Loading branch information
rouault committed Nov 25, 2023
1 parent 1303f5b commit 2e2d840
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions autotest/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,12 @@ register_test(test-unit gdal_unit_test)

include(GdalTestTarget)

add_library(main_gtest OBJECT main_gtest.cpp)
target_include_directories(main_gtest PRIVATE $<TARGET_PROPERTY:gtest_for_gdal,INTERFACE_INCLUDE_DIRECTORIES>)
gdal_standard_includes(main_gtest)

gdal_test_target(testblockcache testblockcache.cpp)
target_sources(testblockcache PRIVATE main_gtest.cpp)
target_link_libraries(testblockcache PRIVATE gtest_for_gdal)
target_link_libraries(testblockcache PRIVATE gtest_for_gdal main_gtest)

register_test(
test-block-cache-1
Expand Down Expand Up @@ -273,8 +276,7 @@ endmacro ()

function (gdal_gtest_target _target testlabel _source)
gdal_autotest_target(${_target} ${testlabel} ${_source} ${ARGN})
target_sources(${_target} PRIVATE main_gtest.cpp)
target_link_libraries(${_target} PRIVATE gtest_for_gdal)
target_link_libraries(${_target} PRIVATE gtest_for_gdal main_gtest)
endfunction ()

set(QUICKTEST_LIST
Expand Down

0 comments on commit 2e2d840

Please sign in to comment.