ores.cmake.component.core_src
Table of Contents
src/CMakeLists.txt for a .core component (component-core profile): links its sibling api library ({{api_full_name}}.lib) publicly plus the NATS/service stack privately. Output projects/{component_full}/src/CMakeLists.txt. CMake target declaration for this component. Wires sources, include paths, link dependencies, and the export macro.
See the Template variable reference for the complete list of available variables and their semantics.
1. Template
The full template source. Edit here and re-tangle with
compass build --direct tangle_codegen_templates to regenerate
library/templates/cmake_component_core_src.mustache.
{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cmake.org. Edit the org source. }}
{{{cmake_license}}}
{{#component}}
set(name "{{full_name}}")
set(lib_binary_name ${name})
set(lib_target_name ${name}.lib)
set(files "")
file(GLOB_RECURSE files RELATIVE
"${CMAKE_CURRENT_SOURCE_DIR}/"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
set(lib_files ${files})
add_library(${lib_target_name} ${lib_files})
target_compile_definitions(${lib_target_name} PRIVATE {{full_name_upper}}_LIBRARY)
set_target_properties(${lib_target_name} PROPERTIES
OUTPUT_NAME ${lib_binary_name})
set_target_properties(${lib_target_name}
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
target_include_directories(${lib_target_name} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_link_libraries(${lib_target_name}
PUBLIC
{{api_full_name}}.lib
ores.nats.lib
PRIVATE
ores.service.lib
ores.platform.lib
ores.utility.lib
ores.security.lib
faker-cxx::faker-cxx
libfort::fort)
# A component declares here what the profile cannot know: the libraries it
# needs beyond the baseline above, and the find_package calls they bring.
# Appending to the target rather than replacing the profile keeps the
# baseline honest for every other component.
{{{extra_dependencies}}}
install(TARGETS ${lib_target_name} LIBRARY DESTINATION lib)
{{/component}}
2. See also
- Parent facet: ores.cmake.component
- Template variable reference