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

cmake: Add fizzy::fizzy-internal INTERFACE library #550

Merged
merged 2 commits into from
Sep 30, 2020
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
6 changes: 6 additions & 0 deletions lib/fizzy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ target_sources(
utf8.hpp
value.hpp
)

# The fizzy::fizzy-internal links fizzy::fizzy library with access to internal headers.
add_library(fizzy-internal INTERFACE)
add_library(fizzy::fizzy-internal ALIAS fizzy-internal)
target_link_libraries(fizzy-internal INTERFACE fizzy::fizzy)
target_include_directories(fizzy-internal INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
2 changes: 0 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ if(HUNTER_ENABLED)
endif()
find_package(GTest REQUIRED)

set(fizzy_include_dir ${PROJECT_SOURCE_DIR}/lib/fizzy)

add_subdirectory(utils)
add_subdirectory(bench)
add_subdirectory(bench_internal)
Expand Down
3 changes: 1 addition & 2 deletions test/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

add_executable(fizzy-bench bench.cpp)
target_compile_features(fizzy-bench PRIVATE cxx_std_17)
target_link_libraries(fizzy-bench PRIVATE fizzy::fizzy fizzy::test-utils benchmark::benchmark)
target_include_directories(fizzy-bench PRIVATE ${fizzy_include_dir})
target_link_libraries(fizzy-bench PRIVATE fizzy::fizzy-internal fizzy::test-utils benchmark::benchmark)

if(UNIX AND NOT APPLE)
# For libstdc++ up to version 8 (included) this is needed for proper <filesystem> support.
Expand Down
3 changes: 1 addition & 2 deletions test/bench_internal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ target_sources(fizzy-bench-internal PRIVATE
parser_benchmarks.cpp
)

target_link_libraries(fizzy-bench-internal PRIVATE fizzy::fizzy fizzy::test-utils benchmark::benchmark_main)
target_include_directories(fizzy-bench-internal PRIVATE ${fizzy_include_dir})
target_link_libraries(fizzy-bench-internal PRIVATE fizzy::fizzy-internal fizzy::test-utils benchmark::benchmark_main)
3 changes: 1 addition & 2 deletions test/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

add_executable(fizzy-fuzz-parser parser_fuzzer.cpp)
target_link_options(fizzy-fuzz-parser PRIVATE -fsanitize=fuzzer)
target_link_libraries(fizzy-fuzz-parser PRIVATE fizzy::fizzy)
target_include_directories(fizzy-fuzz-parser PRIVATE ${fizzy_include_dir})
target_link_libraries(fizzy-fuzz-parser PRIVATE fizzy::fizzy-internal)
3 changes: 1 addition & 2 deletions test/spectests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ find_package(nlohmann_json REQUIRED)

add_executable(fizzy-spectests spectests.cpp)
target_compile_features(fizzy-spectests PRIVATE cxx_std_17)
target_link_libraries(fizzy-spectests PRIVATE fizzy::fizzy fizzy::test-utils nlohmann_json::nlohmann_json)
target_include_directories(fizzy-spectests PRIVATE ${fizzy_include_dir})
target_link_libraries(fizzy-spectests PRIVATE fizzy::fizzy-internal fizzy::test-utils nlohmann_json::nlohmann_json)

if(UNIX AND NOT APPLE)
# For libstdc++ up to version 8 (included) this is needed for proper <filesystem> support.
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include(GoogleTest)

add_executable(fizzy-unittests)
target_link_libraries(fizzy-unittests PRIVATE fizzy::fizzy fizzy::test-utils GTest::gtest_main GTest::gmock)
target_link_libraries(fizzy-unittests PRIVATE fizzy::fizzy-internal fizzy::test-utils GTest::gtest_main GTest::gmock)

target_sources(
fizzy-unittests PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions test/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ target_sources(
)

target_compile_features(test-utils PUBLIC cxx_std_17)
target_include_directories(test-utils PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/lib/fizzy)
target_link_libraries(test-utils PRIVATE fizzy::fizzy wabt::wabt wasm3::wasm3 GTest::gtest)
target_include_directories(test-utils PUBLIC ${PROJECT_SOURCE_DIR})
target_link_libraries(test-utils PUBLIC fizzy::fizzy-internal PRIVATE wabt::wabt wasm3::wasm3 GTest::gtest)