Skip to content

Commit d5210e0

Browse files
committed
cmake export - propagate HAS_SCHEMA definitions to exported IfcParse target
1 parent d303acd commit d5210e0

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

cmake/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,13 @@ endif()
464464

465465
message(STATUS "IFC SCHEMA_VERSIONS that will be used for the build: ${SCHEMA_VERSIONS}.")
466466

467+
set(SCHEMA_DEFINITIONS "")
467468
foreach(schema ${SCHEMA_VERSIONS})
468-
add_definitions(-DHAS_SCHEMA_${schema})
469+
list(APPEND SCHEMA_DEFINITIONS "-DHAS_SCHEMA_${schema}")
469470
endforeach()
470471

471472
string(REPLACE ";" ")(" schema_version_seq "(${SCHEMA_VERSIONS})")
472-
add_definitions(-DSCHEMA_SEQ=${schema_version_seq})
473+
list(APPEND SCHEMA_DEFINITIONS "-DSCHEMA_SEQ=${schema_version_seq}")
473474

474475
if(COMPILE_SCHEMA)
475476
# @todo, this appears to be untested at the moment

src/examples/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ if(STANDALONE_PROJECT OR SCHEMA_VERSIONS MATCHES "2x3")
4747
target_link_libraries(IfcParseExamples ${Boost_LIBRARIES})
4848
target_link_libraries(IfcParseExamples IfcOpenShell::IfcParse)
4949
target_compile_features(IfcParseExamples PRIVATE cxx_std_17)
50-
target_compile_definitions(IfcParseExamples PRIVATE "SCHEMA_SEQ=(2x3)" HAS_SCHEMA_2x3)
5150
else()
5251
target_include_directories(IfcParseExamples PRIVATE "${CMAKE_SOURCE_DIR}/../src")
5352
target_link_libraries(IfcParseExamples IfcParse)
@@ -73,7 +72,6 @@ if(STANDALONE_PROJECT OR SCHEMA_VERSIONS MATCHES "2x3")
7372
INTERFACE ${OpenCASCADE_LIBRARIES} RocksDB::rocksdb
7473
IfcOpenShell::IfcParse IfcOpenShell::geometry_serializer
7574
)
76-
target_compile_definitions(IfcHouseInterface INTERFACE "SCHEMA_SEQ=(2x3)" HAS_SCHEMA_2x3)
7775
else()
7876
target_include_directories(IfcHouseInterface INTERFACE "${CMAKE_SOURCE_DIR}/../src")
7977
target_link_libraries(IfcHouseInterface INTERFACE ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES})
@@ -93,7 +91,6 @@ if(STANDALONE_PROJECT OR SCHEMA_VERSIONS MATCHES "4x3_add2")
9391

9492
if(STANDALONE_PROJECT)
9593
target_include_directories(IfcAlignmentInterface INTERFACE ${Boost_INCLUDE_DIRS})
96-
target_compile_definitions(IfcAlignmentInterface INTERFACE HAS_SCHEMA_4x3_add2)
9794
target_link_libraries(IfcAlignment PRIVATE IfcOpenShell::IfcParse)
9895
target_link_libraries(IfcSimplifiedAlignment PRIVATE IfcOpenShell::IfcParse)
9996
else()

src/ifcparse/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ endforeach()
3131
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
3232

3333
add_library(IfcParse ${IFCPARSE_FILES})
34+
target_compile_definitions(IfcParse PUBLIC ${SCHEMA_DEFINITIONS})
3435
target_include_directories(IfcParse PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
3536
set_target_properties(IfcParse
3637
PROPERTIES

0 commit comments

Comments
 (0)