From 50cbfab391f50efd2f2270f24c3ca2e48e039510 Mon Sep 17 00:00:00 2001 From: Gil Date: Tue, 10 Jul 2018 07:57:54 -0700 Subject: Reorganize cmake dependencies (#1508) * Add cmake dependencies where required ... instead of relying on a topological sort in the top-level CMakeLists.txt. * Add early exits to external project builds --- cmake/external/leveldb.cmake | 72 +++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 34 deletions(-) (limited to 'cmake/external/leveldb.cmake') diff --git a/cmake/external/leveldb.cmake b/cmake/external/leveldb.cmake index 9daab02..8b5d7eb 100644 --- a/cmake/external/leveldb.cmake +++ b/cmake/external/leveldb.cmake @@ -14,6 +14,10 @@ include(ExternalProject) +if(TARGET leveldb) + return() +endif() + if(WIN32 OR LEVELDB_ROOT) # If the user has supplied a LEVELDB_ROOT then just use it. Add an empty # custom target so that the superbuild depdendencies don't all have to be @@ -24,50 +28,50 @@ if(WIN32 OR LEVELDB_ROOT) # https://github.com/google/leveldb/issues/363 # https://github.com/google/leveldb/issues/466 add_custom_target(leveldb) + return() +endif() -else() - # Clean up warning output to reduce noise in the build - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") - set( - LEVELDB_CXX_FLAGS "\ - -Wno-deprecated-declarations" - ) - endif() - # Map CMake compiler configuration down onto the leveldb Makefile +# Clean up warning output to reduce noise in the build +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") set( - LEVELDB_OPT "\ - $<$:${CMAKE_CXX_FLAGS_DEBUG}> \ - $<$:${CMAKE_CXX_FLAGS_RELEASE}>" + LEVELDB_CXX_FLAGS "\ + -Wno-deprecated-declarations" ) +endif() - ExternalProject_Add( - leveldb +# Map CMake compiler configuration down onto the leveldb Makefile +set( + LEVELDB_OPT "\ + $<$:${CMAKE_CXX_FLAGS_DEBUG}> \ + $<$:${CMAKE_CXX_FLAGS_RELEASE}>" +) - DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR} - DOWNLOAD_NAME leveldb-v1.20.tar.gz - URL https://github.com/google/leveldb/archive/v1.20.tar.gz - URL_HASH SHA256=f5abe8b5b209c2f36560b75f32ce61412f39a2922f7045ae764a2c23335b6664 +ExternalProject_Add( + leveldb - PREFIX ${FIREBASE_BINARY_DIR}/external/leveldb + DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR} + DOWNLOAD_NAME leveldb-v1.20.tar.gz + URL https://github.com/google/leveldb/archive/v1.20.tar.gz + URL_HASH SHA256=f5abe8b5b209c2f36560b75f32ce61412f39a2922f7045ae764a2c23335b6664 - # LevelDB's configuration is done in the Makefile - CONFIGURE_COMMAND "" + PREFIX ${FIREBASE_BINARY_DIR}/external/leveldb - # The Makefile-based build of leveldb does not support building - # out-of-source. - BUILD_IN_SOURCE ON + # LevelDB's configuration is done in the Makefile + CONFIGURE_COMMAND "" - # Only build the leveldb library skipping the tools and in-memory - # implementation we don't use. - BUILD_COMMAND - env CXXFLAGS=${LEVELDB_CXX_FLAGS} OPT=${LEVELDB_OPT} - make -j out-static/libleveldb.a + # The Makefile-based build of leveldb does not support building + # out-of-source. + BUILD_IN_SOURCE ON - INSTALL_DIR ${FIREBASE_INSTALL_DIR} + # Only build the leveldb library skipping the tools and in-memory + # implementation we don't use. + BUILD_COMMAND + env CXXFLAGS=${LEVELDB_CXX_FLAGS} OPT=${LEVELDB_OPT} + make -j out-static/libleveldb.a - INSTALL_COMMAND "" - TEST_COMMAND "" - ) + INSTALL_DIR ${FIREBASE_INSTALL_DIR} -endif(WIN32 OR LEVELDB_ROOT) + INSTALL_COMMAND "" + TEST_COMMAND "" +) -- cgit v1.2.3