pcm: Copy schema to build directory in out-of-tree builds

When running from the build directory, the schema must be present in the
build directory. This wasn't working on out-of-tree builds though, since
it was never copied there.
This commit is contained in:
Ian McInerney 2022-09-24 20:20:43 +01:00
parent d8272b0830
commit a7242f423c
1 changed files with 12 additions and 0 deletions

View File

@ -63,6 +63,18 @@ target_include_directories(
PRIVATE $<TARGET_PROPERTY:common,INTERFACE_INCLUDE_DIRECTORIES> PRIVATE $<TARGET_PROPERTY:common,INTERFACE_INCLUDE_DIRECTORIES>
) )
# Copy the schema to the build directory when building outside the source tree
# to allow for proper running of kicad from the build directory.
if( NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR} ) )
file( GLOB SCHEMA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/schemas/*.json )
add_custom_target( schema_build_copy ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/schemas ${CMAKE_BINARY_DIR}/schemas
DEPENDS ${SCHEMA_FILES}
COMMENT "Copying schema files into build directory"
)
endif()
INSTALL( DIRECTORY INSTALL( DIRECTORY
schemas schemas
DESTINATION ${KICAD_DATA} DESTINATION ${KICAD_DATA}