diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index b5dc34c..03fb08c 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -87,6 +87,7 @@ endif() # Builds as statically linked option(COS_BUILD_STATIC "Build all static" OFF) if(COS_BUILD_STATIC) + add_definitions(-DCOS_BUILD_STATIC) set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")# -static") endif() diff --git a/gucc/CMakeLists.txt b/gucc/CMakeLists.txt index efc7739..344fdfd 100644 --- a/gucc/CMakeLists.txt +++ b/gucc/CMakeLists.txt @@ -8,6 +8,12 @@ project(gucc VERSION 0.0.1 LANGUAGES CXX) + +set(GUCC_LOGGER_FILES "") +if(NOT COS_BUILD_STATIC) + set(GUCC_LOGGER_FILES "src/logger.cpp include/gucc/logger.hpp") +endif() + add_library(${PROJECT_NAME} #SHARED #src/utils.cpp src/utils.hpp src/io_utils.cpp include/gucc/io_utils.hpp @@ -31,8 +37,8 @@ add_library(${PROJECT_NAME} #SHARED src/umount_partitions.cpp include/gucc/umount_partitions.hpp src/hwclock.cpp include/gucc/hwclock.hpp src/package_profiles.cpp include/gucc/package_profiles.hpp - src/logger.cpp include/gucc/logger.hpp src/fetch_file.cpp include/gucc/fetch_file.hpp + ${GUCC_LOGGER_FILES} #src/chwd_profiles.cpp src/chwd_profiles.hpp #src/disk.cpp src/disk.hpp ) diff --git a/src/main.cpp b/src/main.cpp index 0fd4d51..fd73e0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,9 @@ // import gucc #include "gucc/io_utils.hpp" +#ifndef COS_BUILD_STATIC #include "gucc/logger.hpp" +#endif #include // for seconds #include // for regex_search, match_result... @@ -45,8 +47,10 @@ int main() { spdlog::set_level(spdlog::level::debug); spdlog::flush_every(std::chrono::seconds(5)); +#ifndef COS_BUILD_STATIC // Set gucc logger. gucc::logger::set_logger(logger); +#endif if (!utils::handle_connection()) { error_inter("An active network connection could not be detected, please connect and restart the installer.\n");