diff --git a/build-gtest.sh b/build-gtest.sh index c92c0f2dc..6243f112f 100755 --- a/build-gtest.sh +++ b/build-gtest.sh @@ -27,8 +27,8 @@ fi echo "Add ios and arm64 build steps for googletest" cat > $GTEST_PATH/CMakeLists_temp.txt << EOF # If building for iOS, set all the iOS options -if(BUILD_IOS) - set(TARGET_ARCH "APPLE") +if(BUILD_IOS) + set(TARGET_ARCH "APPLE") set(IOS True) set(APPLE True) set(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE) diff --git a/build.sh b/build.sh index ee864d938..aa4812eb9 100755 --- a/build.sh +++ b/build.sh @@ -193,7 +193,7 @@ make package # Install newly generated package if [ -f /usr/bin/dpkg ]; then - # Ubuntu / Debian / Raspbian + # Ubuntu / Debian / Raspbian [[ -z "$NOROOT" ]] && sudo dpkg -i *.deb || echo "No root: skipping package deployment." elif [ -f /usr/bin/rpmbuild ]; then # Redhat / Centos diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index bb2e54568..ab4172046 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -276,7 +276,9 @@ if(BUILD_SHARED_LIBS STREQUAL "ON") # Prefer shared libraries for sqlite3 and zlib add_library(sqlite3 SHARED IMPORTED GLOBAL) add_library(z SHARED IMPORTED GLOBAL) - target_link_libraries(mat PUBLIC sqlite3 PUBLIC z ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" "${CMAKE_REQUIRED_LIBRARIES}") + find_package(SQLite3 REQUIRED) + find_package(ZLIB REQUIRED) + target_link_libraries(mat PUBLIC SQLite::SQLite3 PUBLIC ZLIB::ZLIB ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" "${CMAKE_REQUIRED_LIBRARIES}") endif() # target_link_libraries(mat PUBLIC libsqlite3 libcurl.a libz.a libssl.a libcrypto.a "${SQLITE_LIBRARY}" "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" ) diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 99b2c17e3..48abecb38 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -52,10 +52,10 @@ if(PAL_IMPLEMENTATION STREQUAL "WIN32") # Link against prebuilt libraries on Windows message("--- WIN32: Linking against prebuilt libraries") message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gtest") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gmock") + message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gmock") message("--- WIN32: ... ${CMAKE_BINARY_DIR}/zlib") message("--- WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") - # link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/) + # link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib ) target_link_libraries(FuncTests mat @@ -73,7 +73,8 @@ else() elseif(EXISTS "/usr/local/opt/sqlite/lib/libsqlite3.a") set (SQLITE3_LIB "/usr/local/opt/sqlite/lib/libsqlite3.a") else() - set (SQLITE3_LIB "sqlite3") + find_package(SQLite3 REQUIRED) + set (SQLITE3_LIB SQLite::SQLite3) endif() # Find zlib @@ -113,7 +114,7 @@ else() ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/googletest/build/lib/ ) - target_link_libraries(FuncTests + target_link_libraries(FuncTests ${LIBGTEST} ${LIBGMOCK} mat diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index d87184bbb..57c26eaf2 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -61,12 +61,12 @@ endif() if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests) list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp + ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientUtilsTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientTests.cpp ) endif() - + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS @@ -115,7 +115,8 @@ else() elseif(EXISTS "/usr/local/opt/sqlite/lib/libsqlite3.a") set (SQLITE3_LIB "/usr/local/opt/sqlite/lib/libsqlite3.a") else() - set (SQLITE3_LIB "sqlite3") + find_package(SQLite3 REQUIRED) + set (SQLITE3_LIB SQLite::SQLite3) endif() # Find zlib @@ -155,7 +156,7 @@ else() ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/googletest/build/lib/ ) - target_link_libraries(UnitTests + target_link_libraries(UnitTests ${LIBGTEST} ${LIBGMOCK} mat