diff --git a/.cirrus.yml b/.cirrus.yml index 04143b68..8f0c1f0b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ task: freebsd_instance: matrix: - - image_family: freebsd-14-2 + - image_family: freebsd-15-0-amd64-ufs install_script: pkg install -y cmake script: - cmake -B build -DLIBDEFLATE_BUILD_TESTS=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 79f8badd..85366515 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE) endif() +if(DEFINED CMAKE_C_FLAGS_RELEASE) + set(LIBDEFLATE_USER_SET_RELEASE_FLAGS ON) +endif() + # With MSVC, don't automatically append /W3 to the compiler flags. # This makes it possible for the user to select /W4. if(POLICY CMP0092) @@ -64,7 +68,10 @@ if(NOT LIBDEFLATE_BUILD_STATIC_LIB) endif() # Set common C compiler flags for all targets (the library and the programs). -set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") +if(NOT LIBDEFLATE_USER_SET_RELEASE_FLAGS) + set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG" + CACHE STRING "C compiler flags for release builds" FORCE) +endif() set(CMAKE_C_STANDARD 99) if(NOT MSVC) check_c_compiler_flag(-Wdeclaration-after-statement HAVE_WDECLARATION_AFTER_STATEMENT) @@ -366,4 +373,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdeflate-config.cmake # Build the programs subdirectory if needed. if(LIBDEFLATE_BUILD_GZIP OR LIBDEFLATE_BUILD_TESTS) add_subdirectory(programs) -endif() \ No newline at end of file +endif()