Skip to content

Commit

Permalink
add support for interface libraries (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Sky authored Jun 19, 2024
1 parent 1f03b18 commit 53537eb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmake/CppfrontHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,16 @@ function(cppfront_enable)
list(FILTER sources INCLUDE REGEX "\\.(cpp|h)2$")

if (sources)
target_link_libraries("${tgt}" PRIVATE cppfront::cpp2util)
get_target_property(type "${tgt}" TYPE)
if (type STREQUAL "INTERFACE_LIBRARY")
set(visibility "INTERFACE")
else ()
set(visibility "PRIVATE")
endif ()

target_link_libraries("${tgt}" ${visibility} cppfront::cpp2util)
cppfront_generate_cpp(cpp1sources ${sources})
target_sources("${tgt}" PRIVATE ${cpp1sources})
target_sources("${tgt}" ${visibility} ${cpp1sources})
set_source_files_properties(${cpp1sources} PROPERTIES CXX_SCAN_FOR_MODULES ON)
endif ()
endforeach ()
Expand Down

0 comments on commit 53537eb

Please sign in to comment.