aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-09 18:22:25 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-09 18:22:25 +0200
commitaf448d3883f53e86b46d79f879aa790d3fbb7679 (patch)
tree8ad12cc5a8ab9671d7e8125970062f4c9697db17
parentMerge pull request #2764 (diff)
parentcmake: add dep of version lib on version.cpp (diff)
downloadmonero-af448d3883f53e86b46d79f879aa790d3fbb7679.tar.xz
Merge pull request #2694
11e0deef cmake: add dep of version lib on version.cpp (redfish) 35340259 .gitignore: do not ignore cmake source files (redfish)
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/GenVersion.cmake (renamed from src/version.cmake)0
-rw-r--r--cmake/Version.cmake (renamed from version.cmake)2
-rw-r--r--src/CMakeLists.txt28
5 files changed, 17 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index a27982af1..0bd9ba3dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,7 +61,6 @@ CMakeCache.txt
CMakeFiles
cmake_install.cmake
install_manifest.txt
-*.cmake
### Linux ###
*~
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2964e299c..637e9c4e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -703,8 +703,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS)
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
endif()
-include(version.cmake)
-
find_path(ZMQ_INCLUDE_PATH zmq.hpp)
find_library(ZMQ_LIB zmq)
find_library(PGM_LIBRARY pgm)
diff --git a/src/version.cmake b/cmake/GenVersion.cmake
index 45a97cd20..45a97cd20 100644
--- a/src/version.cmake
+++ b/cmake/GenVersion.cmake
diff --git a/version.cmake b/cmake/Version.cmake
index 75343c381..fb636c4ff 100644
--- a/version.cmake
+++ b/cmake/Version.cmake
@@ -41,7 +41,7 @@ elseif (GIT_FOUND OR Git_FOUND)
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
- "-P" "src/version.cmake"
+ "-P" "cmake/GenVersion.cmake"
BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
else()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6fb08b645..0281b1df6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -83,26 +83,30 @@ function (monero_add_executable name)
endfunction ()
function (monero_add_library name)
- source_group("${name}"
- FILES
- ${ARGN})
+ monero_add_library_with_deps(NAME "${name}" SOURCES ${ARGN})
+endfunction()
+
+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
# objects together. The virtual libraries can be arbitrarily combined to link
# any subset of objects into one library archive. This is used for releasing
# libwallet, which combines multiple components.
- set(objlib obj_${name})
- add_library(${objlib} OBJECT ${ARGN})
- add_library("${name}" $<TARGET_OBJECTS:${objlib}>)
- set_property(TARGET "${name}"
- PROPERTY
- FOLDER "libs")
+ set(objlib obj_${MONERO_ADD_LIBRARY_NAME})
+ add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES})
+ add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>)
+ if (MONERO_ADD_LIBRARY_DEPENDS)
+ add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS})
+ endif()
+ set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs")
target_compile_definitions(${objlib}
- PRIVATE $<TARGET_PROPERTY:${name},INTERFACE_COMPILE_DEFINITIONS>)
+ PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>)
endfunction ()
-set_source_files_properties(${CMAKE_BINARY_DIR}/version.cpp PROPERTIES GENERATED ON)
-monero_add_library(version ${CMAKE_BINARY_DIR}/version.cpp)
+include(Version)
+monero_add_library(version SOURCES ${CMAKE_BINARY_DIR}/version.cpp DEPENDS genversion)
add_subdirectory(common)
add_subdirectory(crypto)