Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a compile definition for setting GZ_CONFIG_PATH #1341

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading