From 67f7d7ec8bfbc363ca32c69a4cce3abc852d07ca Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 15 Apr 2022 18:03:23 -0600 Subject: [PATCH] build: pass testmaps directory to testqbsp --- CMakeLists.txt | 5 +++++ qbsp/CMakeLists.txt | 5 +++-- qbsp/test_qbsp.cc | 1 + testmaps.hh.in | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 testmaps.hh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 71a27350..f8cba336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,11 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) find_package(TBB REQUIRED) +# just creates testmaps.hh with absolute path to the testmaps source directory. +# include it as #include +configure_file(testmaps.hh.in testmaps.hh @ONLY) +include_directories(${CMAKE_BINARY_DIR}) + add_subdirectory(3rdparty) add_subdirectory(common) add_subdirectory(bspinfo) diff --git a/qbsp/CMakeLists.txt b/qbsp/CMakeLists.txt index 340a211f..1d178215 100644 --- a/qbsp/CMakeLists.txt +++ b/qbsp/CMakeLists.txt @@ -45,9 +45,10 @@ add_custom_command(TARGET qbsp POST_BUILD enable_testing() -set(QBSP_TEST_SOURCE +set(QBSP_TEST_SOURCE test.cc - test_qbsp.cc) + test_qbsp.cc + ${CMAKE_BINARY_DIR}/testmaps.hh) add_executable(testqbsp ${QBSP_TEST_SOURCE}) target_link_libraries (testqbsp libqbsp common ${CMAKE_THREAD_LIBS_INIT} TBB::tbb gtest fmt::fmt) diff --git a/qbsp/test_qbsp.cc b/qbsp/test_qbsp.cc index bebfb07e..adfd9f59 100644 --- a/qbsp/test_qbsp.cc +++ b/qbsp/test_qbsp.cc @@ -2,6 +2,7 @@ #include #include +#include #include diff --git a/testmaps.hh.in b/testmaps.hh.in new file mode 100644 index 00000000..3405a22b --- /dev/null +++ b/testmaps.hh.in @@ -0,0 +1 @@ +const char *testmaps_dir = "@CMAKE_SOURCE_DIR@/testmaps";