Skip to content

Commit 475db6e

Browse files
committed
Find optional-lite library too
1 parent 1d3bbec commit 475db6e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ else ()
2929

3030
endif()
3131

32-
add_subdirectory(thirdparty)
3332

3433
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
3534
set(JINJA2CPP_IS_MAIN_PROEJCT TRUE)
@@ -52,7 +51,9 @@ add_library(${LIB_TARGET_NAME} STATIC
5251
${PublicHeaders}
5352
)
5453

55-
target_link_libraries(${LIB_TARGET_NAME} PUBLIC expected-lite variant-lite value-ptr-lite boost_variant boost_filesystem boost_algorithm)
54+
add_subdirectory(thirdparty)
55+
56+
target_link_libraries(${LIB_TARGET_NAME} PUBLIC expected-lite variant-lite value-ptr-lite optional-lite boost_variant boost_filesystem boost_algorithm)
5657

5758
target_include_directories(${LIB_TARGET_NAME}
5859
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

thirdparty/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ else()
3434
endif()
3535

3636
find_package(variant-lite QUIET)
37-
if(variant-lite_FOUND)
37+
find_package(optional-lite QUIET)
38+
if(variant-lite_FOUND AND optional-lite_FOUND)
3839
imported_target_alias(variant-lite ALIAS variant-lite::variant-lite)
40+
imported_target_alias(optional-lite ALIAS optional-lite::optional-lite)
3941
else()
40-
message(STATUS "variant-lite not found, using submodule")
42+
message(STATUS "variant-lite or optional-lite not found, using submodule")
4143
update_submodule(nonstd/variant-light)
4244
add_subdirectory(nonstd/variant-light EXCLUDE_FROM_ALL)
4345
# There's a bug in the lib, the target does not include the header include dirs.
4446
# See https://github.com/martinmoene/variant-lite/issues/25
4547
target_include_directories(variant-lite INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/nonstd/variant-light/include")
48+
49+
# Fake target until we use separated optional-lite as submodule
50+
# See https://github.com/martinmoene/variant-lite/issues/19
51+
add_library(optional-lite ALIAS variant-lite)
4652
endif()
4753

4854
find_package(value-ptr-lite QUIET)
@@ -52,6 +58,7 @@ else()
5258
message(STATUS "value-ptr-lite not found, using submodule")
5359
update_submodule(nonstd/value-ptr-lite)
5460
add_subdirectory(nonstd/value-ptr-lite EXCLUDE_FROM_ALL)
61+
5562
add_library(value-ptr-lite ALIAS value_ptr-lite)
5663
endif()
5764

0 commit comments

Comments
 (0)