mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07:00
cmake: add dep of version lib on version.cpp
Also, move cmake source files into cmake/ to keep them together.
This commit is contained in:
parent
353402595c
commit
11e0deef31
@ -698,8 +698,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS)
|
|||||||
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
|
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(version.cmake)
|
|
||||||
|
|
||||||
find_path(ZMQ_INCLUDE_PATH zmq.hpp)
|
find_path(ZMQ_INCLUDE_PATH zmq.hpp)
|
||||||
find_library(ZMQ_LIB zmq)
|
find_library(ZMQ_LIB zmq)
|
||||||
find_library(SODIUM_LIBRARY sodium)
|
find_library(SODIUM_LIBRARY sodium)
|
||||||
|
@ -41,7 +41,7 @@ elseif (GIT_FOUND OR Git_FOUND)
|
|||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
"-D" "GIT=${GIT_EXECUTABLE}"
|
"-D" "GIT=${GIT_EXECUTABLE}"
|
||||||
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
|
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
|
||||||
"-P" "src/version.cmake"
|
"-P" "cmake/GenVersion.cmake"
|
||||||
BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
|
BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||||
else()
|
else()
|
@ -83,26 +83,30 @@ function (monero_add_executable name)
|
|||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
function (monero_add_library name)
|
function (monero_add_library name)
|
||||||
source_group("${name}"
|
monero_add_library_with_deps(NAME "${name}" SOURCES ${ARGN})
|
||||||
FILES
|
endfunction()
|
||||||
${ARGN})
|
|
||||||
|
function (monero_add_library_with_deps)
|
||||||
|
cmake_parse_arguments(MONERO_ADD_LIBRARY "" "NAME" "DEPENDS;SOURCES" ${ARGN})
|
||||||
|
source_group("${MONERO_ADD_LIBRARY_NAME}" FILES ${MONERO_ADD_LIBRARY_SOURCES})
|
||||||
|
|
||||||
# Define a ("virtual") object library and an actual library that links those
|
# Define a ("virtual") object library and an actual library that links those
|
||||||
# objects together. The virtual libraries can be arbitrarily combined to link
|
# objects together. The virtual libraries can be arbitrarily combined to link
|
||||||
# any subset of objects into one library archive. This is used for releasing
|
# any subset of objects into one library archive. This is used for releasing
|
||||||
# libwallet, which combines multiple components.
|
# libwallet, which combines multiple components.
|
||||||
set(objlib obj_${name})
|
set(objlib obj_${MONERO_ADD_LIBRARY_NAME})
|
||||||
add_library(${objlib} OBJECT ${ARGN})
|
add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES})
|
||||||
add_library("${name}" $<TARGET_OBJECTS:${objlib}>)
|
add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>)
|
||||||
set_property(TARGET "${name}"
|
if (MONERO_ADD_LIBRARY_DEPENDS)
|
||||||
PROPERTY
|
add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS})
|
||||||
FOLDER "libs")
|
endif()
|
||||||
|
set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs")
|
||||||
target_compile_definitions(${objlib}
|
target_compile_definitions(${objlib}
|
||||||
PRIVATE $<TARGET_PROPERTY:${name},INTERFACE_COMPILE_DEFINITIONS>)
|
PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
set_source_files_properties(${CMAKE_BINARY_DIR}/version.cpp PROPERTIES GENERATED ON)
|
include(Version)
|
||||||
monero_add_library(version ${CMAKE_BINARY_DIR}/version.cpp)
|
monero_add_library(version SOURCES ${CMAKE_BINARY_DIR}/version.cpp DEPENDS genversion)
|
||||||
|
|
||||||
add_subdirectory(common)
|
add_subdirectory(common)
|
||||||
add_subdirectory(crypto)
|
add_subdirectory(crypto)
|
||||||
|
Loading…
Reference in New Issue
Block a user