diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 5744b59..eac75e5 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,4 +1,4 @@ # Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +configure_file("ovni.h.in" "${CMAKE_CURRENT_BINARY_DIR}/ovni.h") diff --git a/include/ovni.h b/include/ovni.h.in similarity index 98% rename from include/ovni.h rename to include/ovni.h.in index b1a123b..88c38ab 100644 --- a/include/ovni.h +++ b/include/ovni.h.in @@ -34,7 +34,7 @@ typedef struct json_value_t JSON_Value; #define OVNI_STREAM_EXT ".obs" /* Follow https://semver.org rules for versioning */ -#define OVNI_LIB_VERSION "1.2.0" +#define OVNI_LIB_VERSION "@PROJECT_VERSION@" /* ----------------------- common ------------------------ */ diff --git a/src/emu/CMakeLists.txt b/src/emu/CMakeLists.txt index 14782cc..380c146 100644 --- a/src/emu/CMakeLists.txt +++ b/src/emu/CMakeLists.txt @@ -56,6 +56,7 @@ add_library(emu STATIC kernel/setup.c kernel/event.c ) +target_link_libraries(emu ovni-static) add_executable(ovniemu ovniemu.c) target_link_libraries(ovniemu emu parson-static ovni-static) @@ -78,7 +79,7 @@ if(USE_MPI) endif() find_package(MPI REQUIRED) add_executable(ovnisync ovnisync.c) - target_link_libraries(ovnisync m MPI::MPI_C) + target_link_libraries(ovnisync ovni-static m MPI::MPI_C) install(TARGETS ovnisync) else() message(STATUS "Disabling ovnisync as MPI is disabled") diff --git a/src/rt/CMakeLists.txt b/src/rt/CMakeLists.txt index 7dd429f..1166cbd 100644 --- a/src/rt/CMakeLists.txt +++ b/src/rt/CMakeLists.txt @@ -5,14 +5,14 @@ include_directories("${CMAKE_SOURCE_DIR}/src/include") add_library(ovni SHARED ovni.c) target_link_libraries(ovni parson common) -target_include_directories(ovni PUBLIC "${CMAKE_SOURCE_DIR}/include") +target_include_directories(ovni PUBLIC "${CMAKE_BINARY_DIR}/include") set_target_properties(ovni PROPERTIES - VERSION 1.2.0 - SOVERSION 1 - PUBLIC_HEADER "${CMAKE_SOURCE_DIR}/include/ovni.h") + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + PUBLIC_HEADER "${CMAKE_BINARY_DIR}/include/ovni.h") add_library(ovni-static STATIC ovni.c) target_link_libraries(ovni-static parson-static common-static) -target_include_directories(ovni-static PUBLIC "${CMAKE_SOURCE_DIR}/include") +target_include_directories(ovni-static PUBLIC "${CMAKE_BINARY_DIR}/include") install(TARGETS ovni) diff --git a/test/emu/common/CMakeLists.txt b/test/emu/common/CMakeLists.txt index 265f7f2..6ca36fc 100644 --- a/test/emu/common/CMakeLists.txt +++ b/test/emu/common/CMakeLists.txt @@ -8,4 +8,4 @@ target_include_directories(instr-static PRIVATE "${CMAKE_SOURCE_DIR}/src/include" PRIVATE "${CMAKE_SOURCE_DIR}/include" ) -target_link_libraries(ovni-static parson-static common-static) +target_link_libraries(instr-static ovni-static parson-static common-static) diff --git a/test/macros.cmake b/test/macros.cmake index 5e879bc..5be8236 100644 --- a/test/macros.cmake +++ b/test/macros.cmake @@ -115,7 +115,7 @@ function(ovni_test source) add_executable("${OVNI_TEST_NAME}" "${OVNI_TEST_SOURCE}") - target_link_libraries("${OVNI_TEST_NAME}" PRIVATE ovni emu) + target_link_libraries("${OVNI_TEST_NAME}" PRIVATE ovni-static emu) set(driver "${OVNI_TEST_SOURCE_DIR}/ovni-driver.sh")