Skip to content

Commit 43340d3

Browse files
authored
feat: support Cpp2 headers (#80)
1 parent 125cfb1 commit 43340d3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmake/CppfrontHelpers.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ function(_cppfront_generate_source src out)
3434

3535
# assume no SHA256 collisions
3636
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/_cppfront/")
37-
set(out_file "${CMAKE_BINARY_DIR}/_cppfront/${basename}.cpp")
37+
if(src MATCHES [[.*\.h2]])
38+
set(ext ".h")
39+
else()
40+
set(ext ".cpp")
41+
endif()
42+
set(out_file "${CMAKE_BINARY_DIR}/_cppfront/${basename}${ext}")
3843

3944
add_custom_command(
4045
OUTPUT "${out_file}"
@@ -61,7 +66,7 @@ function(cppfront_enable)
6166

6267
foreach (tgt IN LISTS ARG_TARGETS)
6368
get_property(sources TARGET "${tgt}" PROPERTY SOURCES)
64-
list(FILTER sources INCLUDE REGEX "\\.cpp2$")
69+
list(FILTER sources INCLUDE REGEX "\\.(cpp|h)2$")
6570

6671
if (sources)
6772
target_link_libraries("${tgt}" PRIVATE cppfront::cpp2util)

0 commit comments

Comments
 (0)