Skip to content

Commit

Permalink
Merge pull request #8826 from rouault/autotest_main_gtest
Browse files Browse the repository at this point in the history
autotest/cpp/CMakeLists.txt: avoid recompiling main_gtest.cpp multiple times
  • Loading branch information
rouault authored Nov 25, 2023
2 parents 1303f5b + 8499a8e commit 31ef7db
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 STATIC main_gtest.cpp)
target_link_libraries(main_gtest PRIVATE gtest_for_gdal $<TARGET_NAME:${GDAL_LIB_TARGET_NAME}>)
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 31ef7db

Please sign in to comment.