aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt42
1 files changed, 33 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c31c14350..3a685ee8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,7 @@ if (IOS)
endif()
cmake_minimum_required(VERSION 2.8.7)
+message(STATUS "CMake version ${CMAKE_VERSION}")
project(monero)
@@ -139,7 +140,6 @@ if(ARCH_ID STREQUAL "ppc64le")
set(PPC64LE 1)
set(PPC64 0)
set(PPC 0)
-
endif()
if(ARCH_ID STREQUAL "powerpc64" OR ARCH_ID STREQUAL "ppc64")
@@ -172,6 +172,27 @@ else()
message(STATUS "Building without build tag")
endif()
+if(NOT MANUAL_SUBMODULES)
+ find_package(Git)
+ if(GIT_FOUND)
+ function (check_submodule relative_path)
+ execute_process(COMMAND git -C ${relative_path} rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE localHead)
+ execute_process(COMMAND git rev-parse "HEAD:${relative_path}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE checkedHead)
+ string(COMPARE EQUAL "${localHead}" "${checkedHead}" upToDate)
+ if (upToDate)
+ message(STATUS "Submodule '${relative_path}' is up-to-date")
+ else()
+ message(FATAL_ERROR "Submodule '${relative_path}' is not up-to-date. Please update with\ngit submodule update --init --force ${relative_path}\nor run cmake with -DMANUAL_SUBMODULES=1")
+ endif()
+ endfunction ()
+
+ message(STATUS "Checking submodules")
+ check_submodule(external/miniupnp)
+ check_submodule(external/unbound)
+ check_submodule(external/rapidjson)
+ endif()
+endif()
+
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
@@ -180,6 +201,9 @@ set(PER_BLOCK_CHECKPOINT 1)
if(PER_BLOCK_CHECKPOINT)
add_definitions("-DPER_BLOCK_CHECKPOINT")
+ set(Blocks "blocks")
+else()
+ set(Blocks "")
endif()
list(INSERT CMAKE_MODULE_PATH 0
@@ -409,6 +433,8 @@ if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
+ add_c_flag_if_supported(-pthread CMAKE_C_FLAGS)
+ add_cxx_flag_if_supported(-pthread CMAKE_CXX_FLAGS)
endif()
# Handle OpenSSL, used for sha256sum on binary updates and light wallet ssl http
@@ -498,10 +524,8 @@ if(MSVC)
include_directories(SYSTEM src/platform/msc)
else()
include(TestCXXAcceptsFlag)
- if (NOT ARM6)
- if(NOT DEPENDS OR DEPENDS AND NOT ARM)
- set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
- endif()
+ if (NOT ARCH)
+ set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endif()
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default")
@@ -655,12 +679,10 @@ else()
add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED)
if (noexecstack_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecstack")
- set(LD_RAW_FLAGS ${LD_RAW_FLAGS} -z noexecstack)
endif()
add_linker_flag_if_supported(-Wl,-z,noexecheap noexecheap_SUPPORTED)
if (noexecheap_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
- set(LD_RAW_FLAGS ${LD_RAW_FLAGS} -z noexecheap)
endif()
# some windows linker bits
@@ -863,7 +885,7 @@ endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
- set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32)
+ set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32;bcrypt)
if(DEPENDS)
set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} sicuio sicuin sicuuc sicudt sicutu iconv)
else()
@@ -920,7 +942,9 @@ if(ANDROID)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD)
find_library(ATOMIC atomic)
- list(APPEND EXTRA_LIBRARIES ${ATOMIC})
+ if (ATOMIC_FOUND)
+ list(APPEND EXTRA_LIBRARIES ${ATOMIC})
+ endif()
endif()
find_path(ZMQ_INCLUDE_PATH zmq.hpp)