]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: pass -d0 to b2 if not CMAKE_VERBOSE_MAKEFILE 14651/head
authorKefu Chai <kchai@redhat.com>
Thu, 20 Apr 2017 07:14:02 +0000 (15:14 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 20 Apr 2017 08:56:41 +0000 (16:56 +0800)
also do not hardwire the built components

Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt

index 446e030d5ba08c61fd57075d13fc58d9f874b9bd..8aa2c92be2080e06b3b3af64209518dddcd889a1 100644 (file)
@@ -512,6 +512,12 @@ endif()
 # Boost
 option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
 
+set(BOOST_COMPONENTS
+       thread system regex random program_options date_time iostreams)
+if(WITH_MGR)
+       list(APPEND BOOST_COMPONENTS python)
+endif()
+
 if (WITH_SYSTEM_BOOST)
   if(ENABLE_SHARED)
     set(Boost_USE_STATIC_LIBS OFF)
@@ -527,35 +533,33 @@ else()
   set(BOOST_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/boost")
   set(BOOST_PREFIX "${PROJECT_BINARY_DIR}/boost")
   set(BOOST_BUILD "${PROJECT_BINARY_DIR}/boost-build")
-  set(Boost_USE_STATIC_LIBS ON)
+  string(REPLACE ";" "," BOOST_WITH_LIBS "${BOOST_COMPONENTS}")
   execute_process(COMMAND "./bootstrap.sh"
     "--prefix=${BOOST_PREFIX}"
-    "--with-libraries=atomic,container,context,coroutine,coroutine2,date_time,filesystem,iostreams,program_options,python,random,regex,system,thread"
+    "--with-libraries=${BOOST_WITH_LIBS}"
     WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
-  # 2. install headers
   set(BOOST_ROOT "${BOOST_PREFIX}")
-  execute_process(COMMAND "./b2"
-    #"--buildid=ceph" # changes lib names--can omit for static
-    "--variant=release" # could override
-    "--link=static" # avoid library versioning issues
-    "--threading=multi"
-    "--build-dir=${BOOST_BUILD}"
-    "-j${BOOST_J}"
-    "cxxflags=${BOOST_CFLAGS}"
-    "headers"
+  set(b2 ./b2
+    --build-dir=${BOOST_BUILD} -j${BOOST_J})
+  if(CMAKE_VERBOSE_MAKEFILE)
+    list(APPEND b2 -d1)
+  else()
+    list(APPEND b2 -d0)
+  endif()
+  list(APPEND b2
+    variant=release link=static threading=multi cxxflags=${BOOST_CFLAGS})
+  # 2. install headers
+  execute_process(COMMAND
+    ${b2}
+    headers
     WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
   # 3. build and install libs
-  execute_process(COMMAND "./b2"
-    #"--buildid=ceph" # changes lib names--can omit for static
-    "--variant=release" # could override
-    "--link=static" # avoid library versioning issues
-    "--threading=multi"
-    "--build-dir=${BOOST_BUILD}"
-    "-j${BOOST_J}"
-    "cxxflags=${BOOST_CFLAGS}"
-    "install"
+  execute_process(COMMAND
+    ${b2}
+    install
     WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
   # 4. set hints for FindBoost.cmake
+  set(Boost_USE_STATIC_LIBS ON)
   set(Boost_NO_SYSTEM_PATHS ON)
   include_directories(BEFORE ${BOOST_PREFIX}/include)
   # fixup for CheckIncludeFileCXX
@@ -567,12 +571,6 @@ endif()
 
 set(Boost_USE_MULTITHREADED ON)
 
-set(BOOST_COMPONENTS
-       thread system regex random program_options date_time iostreams)
-if(WITH_MGR)
-       list(APPEND BOOST_COMPONENTS python)
-endif()
-
 # require minimally the bundled version
 find_package(Boost 1.61 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS})