diff --git a/CMakeLists.txt b/CMakeLists.txt index ee4ebb3359..a8ded172ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ cmake_dependent_option( option(PCAPPP_BUILD_TESTS "Build Tests" ${PCAPPP_MAIN_PROJECT}) option(PCAPPP_BUILD_COVERAGE "Generate Coverage Report" OFF) option(PCAPPP_BUILD_FUZZERS "Build Fuzzers binaries" OFF) -option(PCAPPP_BUILD_REPRODUCTIBLE "Build a reproductible version" OFF) +option(PCAPPP_BUILD_REPRODUCIBLE "Build a reproductible version" OFF) option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) @@ -250,16 +250,17 @@ if(PCAPPP_TARGET_COMPILER_CLANG add_compile_options(-Wall) endif() -if (PCAPPP_BUILD_REPRODUCTIBLE) - add_definitions(-DPCAPPP_BUILD_REPRODUCTIBLE) - # We should not use __DATE__ nor __TIME__ in case of reproductible build - add_compile_options($<$:-Wdate-time>) +if (PCAPPP_BUILD_REPRODUCIBLE) + add_definitions(-DPCAPPP_BUILD_REPRODUCIBLE) if(APPLE) if (NOT $ENV{ZERO_AR_DATE}) message(FATAL_ERROR "You need to set `export ZERO_AR_DATE=1`") endif() + elseif(MSVC) + add_link_options(/Brepro) else() - add_link_options(-D) + # We should not use __DATE__ nor __TIME__ in case of reproducible build + add_compile_options(-Wdate-time) endif() endif() diff --git a/Common++/header/PcapPlusPlusVersion.h b/Common++/header/PcapPlusPlusVersion.h index 37f13b6b8f..28ff9c5f37 100644 --- a/Common++/header/PcapPlusPlusVersion.h +++ b/Common++/header/PcapPlusPlusVersion.h @@ -30,7 +30,7 @@ namespace pcpp /** * @return The build date and time in a format of "Mmm dd yyyy hh:mm:ss" */ -#if PCAPPP_BUILD_REPRODUCTIBLE +#if PCAPPP_BUILD_REPRODUCIBLE inline std::string getBuildDateTime() { return std::string("") + " " + std::string(""); } #else inline std::string getBuildDateTime() { return std::string(__DATE__) + " " + std::string(__TIME__); }