Skip to content

Commit

Permalink
Merge pull request #1341 from azeey/voldivh/win_install_cmd
Browse files Browse the repository at this point in the history
Use a compile definition for setting `GZ_CONFIG_PATH`
  • Loading branch information
Voldivh authored Oct 17, 2023
2 parents c63dbd7 + 0d34a61 commit 6903169
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ if (BUILD_TESTING)
XmlUtils.cc)
endif()

if(TARGET UNIT_gz_TEST)
target_compile_definitions(UNIT_gz_TEST PUBLIC "-DDETAIL_GZ_CONFIG_PATH=\"${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>\"")
endif()

if (TARGET UNIT_FrameSemantics_TEST)
target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc Utils.cc)
target_link_libraries(UNIT_FrameSemantics_TEST TINYXML2::TINYXML2)
Expand Down
3 changes: 3 additions & 0 deletions src/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#define pclose _pclose
#endif

// DETAIL_GZ_CONFIG_PATH is compiler definition set in CMake.
#define GZ_CONFIG_PATH DETAIL_GZ_CONFIG_PATH

static std::string SdfVersion()
{
return " --force-version " + std::string(SDF_VERSION_FULL);
Expand Down
7 changes: 1 addition & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
configure_file(test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh.configured)

file(GENERATE
OUTPUT ${PROJECT_BINARY_DIR}/include/test_config.hh
INPUT ${PROJECT_BINARY_DIR}/include/test_config.hh.configured)

configure_file(test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh)
include_directories(
${PROJECT_BINARY_DIR}/include
)
Expand Down
1 change: 0 additions & 1 deletion test/test_config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef SDF_TEST_CONFIG_HH_
#define SDF_TEST_CONFIG_HH_

#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf/$<CONFIG>"
#define GZ_PATH "@GZ_PROGRAM@"
#define GZ_TEST_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src:"\
"@GZ-MSGS_LIBRARY_DIRS@:"
Expand Down

0 comments on commit 6903169

Please sign in to comment.