| 1 |
set(Core_DOWNSTREAM_DEPS "") |
| 2 |
|
| 3 |
# Core component |
| 4 |
add_library(${_libname}_core |
| 5 |
core.cpp |
| 6 |
core.hpp |
| 7 |
core_impl.hpp |
| 8 |
${PROJECT_BINARY_DIR}/version.rc |
| 9 |
# Add more source files here if needed |
| 10 |
) |
| 11 |
|
| 12 |
if (${PROJECT_NAME}_BUILD_SANITIZERS) |
| 13 |
if (CMAKE_COMPILER_IS_GNUCC) |
| 14 |
target_compile_options(${_libname}_core PUBLIC |
| 15 |
-g |
| 16 |
-Wstrict-aliasing |
| 17 |
-fsanitize=address |
| 18 |
) |
| 19 |
target_link_options(${_libname}_core PUBLIC -fsanitize=address) |
| 20 |
elseif (MSVC) |
| 21 |
target_compile_options(${_libname}_core PUBLIC /fsanitize=address /Zi) |
| 22 |
target_link_options(${_libname}_core PUBLIC /DEBUG) |
| 23 |
endif () |
| 24 |
endif () |
| 25 |
|
| 26 |
target_compile_definitions(${_libname}_core PRIVATE LibBGCode_VERSION=R"\(${LibBGCode_VERSION}\)") |
| 27 |
|
| 28 |
generate_export_header(${_libname}_core |
| 29 |
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/core/export.h |
| 30 |
) |
| 31 |
|
| 32 |
target_include_directories(${_libname}_core |
| 33 |
PUBLIC |
| 34 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${_srcloc}> |
| 35 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src> |
| 36 |
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> |
| 37 |
$<INSTALL_INTERFACE:include> |
| 38 |
) |
| 39 |
|
| 40 |
add_library(${namespace}${_libname}_core ALIAS ${_libname}_core) |
| 41 |
|
| 42 |
# Set the version of the project |
| 43 |
# target_sources(Core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/version.h) |
| 44 |
# target_compile_definitions(Core PRIVATE VERSION_MAJOR=${PROJECT_VERSION_MAJOR} VERSION_MINOR=${PROJECT_VERSION_MINOR}) |
| 45 |
|
| 46 |
set(Core_DOWNSTREAM_DEPS ${Core_DOWNSTREAM_DEPS} PARENT_SCOPE) |