Skip to content
Snippets Groups Projects
Commit 04e25bd4 authored by Felix Weiglhofer's avatar Felix Weiglhofer
Browse files

cmake: Fixes for online standalone build.

parent a12ee31f
No related branches found
No related tags found
1 merge request!1784cmake: Fixes for online standalone build.
Pipeline #29149 passed
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
cmake_policy(VERSION 3.14...3.23)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CBM_ONLINE_STANDALONE ON)
project(CbmOnline)
else()
set(CBM_ONLINE_STANDALONE OFF)
if (NOT DEFINED CBM_ONLINE_STANDALONE)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CBM_ONLINE_STANDALONE ON)
project(CbmOnline)
else()
set(CBM_ONLINE_STANDALONE OFF)
endif()
endif()
if (CBM_ONLINE_STANDALONE)
......@@ -46,7 +48,6 @@ if (CBM_ONLINE_STANDALONE)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include(CbmMacros) # for 'download_project_if_needed', 'Gen_Exe_Script' macro
include(../external/InstallGtest.cmake)
add_subdirectory(../external external)
endif()
......
......@@ -7,7 +7,7 @@ set(FLESNET_VERSION cdc7893481aa10d51070d965ae9fc6eebfe91ac2) # 2024-01-23
set(FLESNET_SRC_URL "https://github.com/cbm-fles/flesnet")
set(FLESNET_DESTDIR "${PROJECT_BINARY_DIR}/external/flesnet-prefix")
set(FLESNET_DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/flesnet-prefix")
set(FLESNET_BIN_PREFIX "${FLESNET_DESTDIR}/src/flesnet-build")
download_project_if_needed(
......
set(YAMLCPP_VERSION 0579ae3d976091d7d664aa9d2527e0d0cff25763) # version 0.7.0
set(YAMLCPP_SRC_URL "https://github.com/jbeder/yaml-cpp")
set(YAMLCPP_DESTDIR "${CMAKE_BINARY_DIR}/external/YAMLCPP-prefix")
#set(YAMLCPP_BYPRODUCT "${PROJECT_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(YAMLCPP_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp")
set(YAMLCPP_INCLUDE_DIR "${YAMLCPP_SRC_DIR}/include")
set(YAMLCPP_DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/yaml-cpp-prefix")
set(YAMLCPP_BYPRODUCT "${YAMLCPP_DESTDIR}/src/yaml-cpp-build/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
download_project_if_needed(PROJECT yaml-cpp
GIT_REPOSITORY ${YAMLCPP_SRC_URL}
GIT_TAG ${YAMLCPP_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp
SOURCE_DIR ${YAMLCPP_SRC_DIR}
TEST_FILE CMakeLists.txt
)
......@@ -25,7 +26,7 @@ endif()
ExternalProject_Add(
yaml-cpp
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp
SOURCE_DIR ${YAMLCPP_SRC_DIR}
GIT_CONFIG advice.detachedHead=false
BUILD_IN_SOURCE 0
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
......@@ -35,16 +36,16 @@ ExternalProject_Add(
-DYAML_BUILD_SHARED_LIBS=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
BUILD_COMMAND ${YAMLCPP_BUILD_COMMAND} yaml-cpp
BUILD_BYPRODUCTS ${PROJECT_BINARY_DIR}/external/yaml-cpp-prefix/src/yaml-cpp-build/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_STATIC_LIBRARY_SUFFIX}
BUILD_BYPRODUCTS ${YAMLCPP_BYPRODUCT}
INSTALL_COMMAND ""
)
# pre-create empty directory to make INTERFACE_INCLUDE_DIRECTORIES happy
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/external/yaml-cpp/include)
file(MAKE_DIRECTORY ${YAMLCPP_INCLUDE_DIR})
add_library(external::yaml-cpp STATIC IMPORTED GLOBAL)
add_dependencies(external::yaml-cpp yaml-cpp)
set_target_properties(external::yaml-cpp PROPERTIES
IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/external/yaml-cpp-prefix/src/yaml-cpp-build/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_STATIC_LIBRARY_SUFFIX}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/external/yaml-cpp/include
IMPORTED_LOCATION ${YAMLCPP_BYPRODUCT}
INTERFACE_INCLUDE_DIRECTORIES ${YAMLCPP_INCLUDE_DIR}
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment