Skip to content

Commit

Permalink
Rework blueprint cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyMlashkin committed Aug 19, 2024
1 parent 5fe62b1 commit e4772b0
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions libs/blueprint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
cmake_minimum_required(VERSION 3.21.4)
include(CMConfig)
include(CMSetupVersion)

project(crypto3_blueprint VERSION 0.1.0 LANGUAGES C CXX)
cm_project(blueprint WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)

option(CMAKE_ENABLE_TESTS "Enable tests" FALSE) # used by CMTest module
option(BUILD_EXAMPLES "Build examples" FALSE)
include(CMDeploy)

find_package(CM)
cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})

add_library(blueprint INTERFACE)
add_library(crypto3::blueprint ALIAS blueprint)
add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)

include(GNUInstallDirs)
target_include_directories(blueprint INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

target_link_libraries(blueprint INTERFACE
target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${Boost_LIBRARIES}
)

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)

include(CMTest)
cm_add_test_subdirectory(test)

if(BUILD_EXAMPLES)
add_subdirectory(example)
endif()

0 comments on commit e4772b0

Please sign in to comment.