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

Add CMake option to disable building tests #52

Merged
Merged
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
133 changes: 70 additions & 63 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,70 +21,77 @@ include_directories(${Boost_INCLUDE_DIR})
# Include modules
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)

# Add fmt
include_directories(lib/fmt/include/)
add_subdirectory(lib/fmt/)
option(PING_CPP_BUILD_TESTS "Build the test cases when PING_CPP_BUILD_TESTS is enabled." ON)

# test-device
add_executable(test-device)
target_sources(
test-device
PRIVATE
test/test-device.cpp
)
target_link_libraries(
test-device
PRIVATE
DEVICE
HAL
PING_MESSAGES
${Boost_LIBRARIES}
fmt::fmt
)
if (PING_CPP_BUILD_TESTS)
# Add fmt subdirectory
add_subdirectory(lib/fmt/)

# test-device-ping1d
add_executable(test-device-ping1d)
target_sources(
test-device-ping1d
PRIVATE
test/test-device-ping1d.cpp
)
target_link_libraries(
test-device-ping1d
PRIVATE
DEVICE
HAL
PING_MESSAGES
${Boost_LIBRARIES}
fmt::fmt
)
# test-device
add_executable(test-device)
target_include_directories(test-device PRIVATE lib/fmt/include/)
target_sources(
test-device
PRIVATE
test/test-device.cpp
)
target_link_libraries(
test-device
PRIVATE
DEVICE
HAL
PING_MESSAGES
${Boost_LIBRARIES}
fmt::fmt
)

# test-device-ping1d
add_executable(test-device-ping360)
target_sources(
test-device-ping360
PRIVATE
test/test-device-ping360.cpp
)
target_link_libraries(
test-device-ping360
PRIVATE
DEVICE
HAL
PING_MESSAGES
${Boost_LIBRARIES}
fmt::fmt
)
# test-device-ping1d
add_executable(test-device-ping1d)
target_include_directories(test-device-ping1d PRIVATE lib/fmt/include/)
target_sources(
test-device-ping1d
PRIVATE
test/test-device-ping1d.cpp
)
target_link_libraries(
test-device-ping1d
PRIVATE
DEVICE
HAL
PING_MESSAGES
${Boost_LIBRARIES}
fmt::fmt
)

# test-message
add_executable(test-message)
target_sources(
test-message
PRIVATE
test/test-message.cpp
)
target_link_libraries(
test-message
PRIVATE
PING_MESSAGES
)
# test-device-ping360
add_executable(test-device-ping360)
target_include_directories(test-device-ping360 PRIVATE lib/fmt/include/)
target_sources(
test-device-ping360
PRIVATE
test/test-device-ping360.cpp
)
target_link_libraries(
test-device-ping360
PRIVATE
DEVICE
HAL
PING_MESSAGES
${Boost_LIBRARIES}
fmt::fmt
)

# test-message
add_executable(test-message)
target_include_directories(test-message PRIVATE lib/fmt/include/)
target_sources(
test-message
PRIVATE
test/test-message.cpp
)
target_link_libraries(
test-message
PRIVATE
PING_MESSAGES
)
endif()
Loading