From e75575ea66e5cf4b169ddc67d76b9ffb262b187d Mon Sep 17 00:00:00 2001 From: Teddy Reed Date: Thu, 15 Jun 2017 20:59:53 -0700 Subject: [PATCH] build: Remove specific -mt from boost links (#3409) --- CMake/CMakeLibs.cmake | 21 +++++++++++++-- osquery/CMakeLists.txt | 59 ++++++++++++++++-------------------------- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/CMake/CMakeLibs.cmake b/CMake/CMakeLibs.cmake index cc8c6575..7b6a4b55 100644 --- a/CMake/CMakeLibs.cmake +++ b/CMake/CMakeLibs.cmake @@ -128,10 +128,27 @@ macro(ADD_OSQUERY_LINK_INTERNAL LINK LINK_PATHS LINK_SET) endif() if(NOT ${ITEM_SYSTEM}) find_library("${ITEM}_library" - NAMES "${ITEM}.lib" "lib${ITEM}.lib" "lib${ITEM}.a" "${ITEM}" HINTS ${LINK_PATHS_RELATIVE}) + NAMES + "${ITEM}.lib" + "lib${ITEM}.lib" + "lib${ITEM}-mt.a" + "lib${ITEM}.a" + "${ITEM}" + HINTS ${LINK_PATHS_RELATIVE}) else() find_library("${ITEM}_library" - NAMES "${ITEM}.lib" "lib${ITEM}.lib" "lib${ITEM}.so" "lib${ITEM}.dylib" "${ITEM}.so" "${ITEM}.dylib" "${ITEM}" + NAMES + "${ITEM}.lib" + "lib${ITEM}.lib" + "lib${ITEM}-mt.so" + "lib${ITEM}.so" + "lib${ITEM}-mt.dylib" + "lib${ITEM}.dylib" + "${ITEM}-mt.so" + "${ITEM}.so" + "${ITEM}-mt.dylib" + "${ITEM}.dylib" + "${ITEM}" HINTS ${LINK_PATHS_SYSTEM}) endif() LOG_LIBRARY(${ITEM} "${${ITEM}_library}") diff --git a/osquery/CMakeLists.txt b/osquery/CMakeLists.txt index 3df340af..80f3b09d 100644 --- a/osquery/CMakeLists.txt +++ b/osquery/CMakeLists.txt @@ -90,6 +90,14 @@ if(NOT SKIP_TABLES) endif() if(WINDOWS) + if(DEFINED ENV{DEBUG}) + set(WB_KEY "sgd") + set(WO_KEY "_dbg") + set(WT_KEY "d_dbg") + else() + set(WB_KEY "s") + set(WO_KEY "") + endif() ADD_OSQUERY_LINK_CORE("ws2_32.lib") ADD_OSQUERY_LINK_CORE("iphlpapi.lib") ADD_OSQUERY_LINK_CORE("netapi32.lib") @@ -98,25 +106,14 @@ if(WINDOWS) ADD_OSQUERY_LINK_CORE("Wtsapi32.lib") ADD_OSQUERY_LINK_CORE("wbemuuid.lib") ADD_OSQUERY_LINK_CORE("taskschd.lib") - if(DEFINED ENV{DEBUG}) - ADD_OSQUERY_LINK_CORE("libboost_system-vc140-mt-sgd-1_63") - ADD_OSQUERY_LINK_CORE("libboost_regex-vc140-mt-sgd-1_63") - ADD_OSQUERY_LINK_CORE("libboost_filesystem-vc140-mt-sgd-1_63") - ADD_OSQUERY_LINK_CORE("libboost_context-vc140-mt-sgd-1_63") - ADD_OSQUERY_LINK_CORE("rocksdblib_dbg") - ADD_OSQUERY_LINK_CORE("thriftmtd_dbg") - ADD_OSQUERY_LINK_CORE("linenoise_dbg.lib") - ADD_OSQUERY_LINK_CORE("gflags_static_dbg") - else() - ADD_OSQUERY_LINK_CORE("libboost_system-vc140-mt-s-1_63") - ADD_OSQUERY_LINK_CORE("libboost_regex-vc140-mt-s-1_63") - ADD_OSQUERY_LINK_CORE("libboost_filesystem-vc140-mt-s-1_63") - ADD_OSQUERY_LINK_CORE("libboost_context-vc140-mt-s-1_63") - ADD_OSQUERY_LINK_CORE("rocksdblib") - ADD_OSQUERY_LINK_CORE("thriftmt") - ADD_OSQUERY_LINK_CORE("linenoise.lib") - ADD_OSQUERY_LINK_CORE("gflags_static") - endif() + ADD_OSQUERY_LINK_CORE("libboost_system-vc140-mt-${WB_KEY}-1_63") + ADD_OSQUERY_LINK_CORE("libboost_regex-vc140-mt-${WB_KEY}-1_63") + ADD_OSQUERY_LINK_CORE("libboost_filesystem-vc140-mt-${WB_KEY}-1_63") + ADD_OSQUERY_LINK_CORE("libboost_context-vc140-mt-${WB_KEY}-1_63") + ADD_OSQUERY_LINK_CORE("rocksdblib${WO_KEY}") + ADD_OSQUERY_LINK_CORE("thriftmt${WT_KEY}") + ADD_OSQUERY_LINK_CORE("linenoise${WO_KEY}.lib") + ADD_OSQUERY_LINK_CORE("gflags_static${WO_KEY}") ADD_OSQUERY_LINK_CORE("snappy64") ADD_OSQUERY_LINK_CORE("ssleay32") ADD_OSQUERY_LINK_CORE("eay32") @@ -134,20 +131,17 @@ endif() if(APPLE OR LINUX) ADD_OSQUERY_LINK_CORE("libdl") - ADD_OSQUERY_LINK_CORE("boost_system-mt") - ADD_OSQUERY_LINK_CORE("boost_filesystem-mt") - ADD_OSQUERY_LINK_CORE("boost_context-mt") - ADD_OSQUERY_LINK_ADDITIONAL("rocksdb_lite") - ADD_OSQUERY_LINK_ADDITIONAL("boost_regex-mt") elseif(FREEBSD) ADD_OSQUERY_LINK_CORE("icuuc") + ADD_OSQUERY_LINK_ADDITIONAL("rocksdb-lite") +endif() + +if(POSIX) ADD_OSQUERY_LINK_CORE("boost_system") ADD_OSQUERY_LINK_CORE("boost_filesystem") ADD_OSQUERY_LINK_CORE("boost_thread") ADD_OSQUERY_LINK_CORE("boost_context") - - ADD_OSQUERY_LINK_ADDITIONAL("rocksdb-lite") ADD_OSQUERY_LINK_ADDITIONAL("boost_regex") endif() @@ -157,15 +151,9 @@ if(LINUX OR FREEBSD) endif() # Remaining additional development libraries. -if(WINDOWS AND DEFINED ENV{DEBUG}) - ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-uri_dbg") - ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections_dbg") - ADD_OSQUERY_LINK_CORE("glog_dbg") -else() - ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-uri") - ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections") - ADD_OSQUERY_LINK_CORE("glog") -endif() +ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-uri${WO_KEY}") +ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections${WO_KEY}") +ADD_OSQUERY_LINK_CORE("glog${WO_KEY}") if(POSIX) ADD_OSQUERY_LINK_ADDITIONAL("snappy") @@ -178,7 +166,6 @@ endif() if(APPLE) ADD_OSQUERY_LINK_CORE("liblzma libbz2") - ADD_OSQUERY_LINK_CORE("boost_thread-mt") else() if(POSIX) ADD_OSQUERY_LINK_CORE("lzma")