cmake target_compile_options() examples

ddemidov/amgcl CMakeLists.txt :66

target_compile_options(amgcl INTERFACE ${OpenMP_CXX_FLAGS})

ddemidov/amgcl CMakeLists.txt :77

target_compile_options(amgcl INTERFACE
    # Compiler is GNU (g++):
    $<$<CXX_COMPILER_ID:GNU>:$<BUILD_INTERFACE:-Wall;-Wextra;-Wpedantic>>
    # Compiler is Clang:
    $<$<CXX_COMPILER_ID:Clang>:$<BUILD_INTERFACE:-Wall;-Wextra;-Wpedantic;-Wno-c99-extensions>>
    # Compiler is MSVC:
    $<$<CXX_COMPILER_ID:MSVC>:/bigobj>
    $<$<CXX_COMPILER_ID:MSVC>:/wd4715>
    )

assimp/assimp code/CMakeLists.txt :1475

TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror)

BinomialLLC/basis_universal webgl/encoder/CMakeLists.txt :57

#target_compile_options(basis_encoder.js PRIVATE -fno-strict-aliasing -g -O1 -fsanitize=undefined -fsanitize=address)

BinomialLLC/basis_universal webgl/encoder/CMakeLists.txt :84

target_compile_options(basis_encoder_threads.js PRIVATE -fno-strict-aliasing -O3 -matomics -mbulk-memory)

BinomialLLC/basis_universal webgl/transcoder/CMakeLists.txt :59

target_compile_options(basis_transcoder.js PRIVATE -O3 -fno-strict-aliasing)

google/benchmark cmake/GoogleTest.cmake :46

target_compile_options(gtest_main PRIVATE "-w")

erincatto/box2d src/CMakeLists.txt :178

# target_compile_options(box2d PRIVATE)

catchorg/Catch2 CMake/CatchMiscFunctions.cmake :33

target_compile_options(${target} PRIVATE /WX)

catchorg/Catch2 tools/misc/CMakeLists.txt :7

target_compile_options(CoverageHelper PRIVATE /W4 /w44265 /WX /w44061 /w44062)

ccache/ccache cmake/StandardSettings.cmake :7

target_compile_options(standard_settings INTERFACE "/FI${CMAKE_BINARY_DIR}/config.h")

ccache/ccache cmake/StandardSettings.cmake :9

target_compile_options(
  standard_settings
  INTERFACE -include ${CMAKE_BINARY_DIR}/config.h
)

ccache/ccache cmake/StandardSettings.cmake :22

target_compile_options(standard_settings INTERFACE --coverage -O0 -g)

CGAL/cgal Installation/cmake/modules/CGAL_pointmatcher_support.cmake :15

target_compile_options(CGAL::pointmatcher_support INTERFACE "-D_USE_MATH_DEFINES")

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :115

target_compile_options(${target} INTERFACE -fsanitize=address)

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :127

target_compile_options(${target} INTERFACE
  "-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS")

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :138

target_compile_options(${target} INTERFACE "/fp:strict")

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :144

target_compile_options(${target} INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:/fp:strict>")

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :151

target_compile_options(${target} INTERFACE
  "-features=extensions;-library=stlport4;-D_GNU_SOURCE")

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :164

target_compile_options(${target} INTERFACE "-fno-strict-aliasing" )

CGAL/cgal Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake :173

target_compile_options(${target} INTERFACE "-DCGAL_DO_NOT_USE_BOOST_MP")

CGAL/cgal Installation/cmake/modules/CGAL_SetupLEDA.cmake :42

target_compile_options(${target} INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${LIST_LEDA_CXX_FLAGS}>)

CGAL/cgal Installation/cmake/modules/CGAL_SetupLEDA.cmake :43

target_compile_options(${target} INTERFACE ${LIST_LEDA_DEFINITIONS})

CGAL/cgal Installation/cmake/modules/CGAL_target_use_TBB.cmake :15

target_compile_options( ${target} PUBLIC -DNOMINMAX -DCGAL_LINKED_WITH_TBB )

projectchrono/chrono src/chrono/CMakeLists.txt :1411

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${SIMD_FLAGS}>)

projectchrono/chrono src/chrono/CMakeLists.txt :1432

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="/Zc:__cplusplus">) # without this flag the memory alignment seems to be broken

projectchrono/chrono src/chrono/CMakeLists.txt :1451

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-m64>)

projectchrono/chrono src/chrono/CMakeLists.txt :1475

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/W4>)

projectchrono/chrono src/chrono/CMakeLists.txt :1476

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4100>)   # unreferenced formal parameter

projectchrono/chrono src/chrono/CMakeLists.txt :1477

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4127>)   # conditional expression is constant

projectchrono/chrono src/chrono/CMakeLists.txt :1481

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4251>)   # class needs to have dll-interface

projectchrono/chrono src/chrono/CMakeLists.txt :1483

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4324>)   # structure padded due to alignment specifier

projectchrono/chrono src/chrono/CMakeLists.txt :1484

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/wd4324>) # structure padded due to alignment specifier (CUDA)

projectchrono/chrono src/chrono/CMakeLists.txt :1486

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/wd4996>) # WARNING: TODO: DARIOM: CUDA Deprecation: The type will be removed in the next major release

projectchrono/chrono src/chrono/CMakeLists.txt :1488

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd26451>)  # arithmetic overflow

projectchrono/chrono src/chrono/CMakeLists.txt :1493

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wint-in-bool-context>)

projectchrono/chrono src/chrono/CMakeLists.txt :1494

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-sign-compare>)

projectchrono/chrono src/chrono/CMakeLists.txt :1496

target_compile_options(Chrono_core PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-unused-function>)

projectchrono/chrono src/chrono_parsers/CMakeLists.txt :58

target_compile_options(yaml-cpp PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4267>)

projectchrono/chrono src/chrono_ros/CMakeLists.txt :210

target_compile_options(Chrono_ros PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4661>)

projectchrono/chrono src/chrono_ros/CMakeLists.txt :211

target_compile_options(Chrono_ros PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/wd4005>)

projectchrono/chrono src/chrono_swig/chrono_python/CMakeLists.txt :178

target_compile_options(core PRIVATE "/wd4275")  # non-DLL-interface class used as base for DLL-interface class

projectchrono/chrono src/chrono_swig/chrono_python/CMakeLists.txt :676

target_compile_options(vehicle PRIVATE "/wd4456")  # declaration hides previous local declaration

projectchrono/chrono src/chrono_swig/chrono_python/CMakeLists.txt :841

target_compile_options(robot PRIVATE "/wd4702")  # unreachable code

projectchrono/chrono src/chrono_swig/chrono_python/CMakeLists.txt :1010

target_compile_options(ros PRIVATE "/wd4275")  # non-DLL-interface class used as base for DLL-interface class

projectchrono/chrono src/chrono_synchrono/CMakeLists.txt :184

target_compile_options(Chrono_synchrono PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/wd4661>)

DaveGamble/cJSON CMakeLists.txt :255

target_compile_options(${TEST_CJSON} PRIVATE "-fno-sanitize=float-divide-by-zero")

drowe67/codec2 stm32/CMakeLists.txt :310

target_compile_options(sm1000v5 PRIVATE "-O3")

mosra/corrade src/Corrade/Utility/CMakeLists.txt :237

target_compile_options(CorradeUtility INTERFACE -fno-strict-aliasing)

google/cppdap CMakeLists.txt :201

target_compile_options(${target} PUBLIC "-fsanitize=address")

google/cppdap CMakeLists.txt :320

target_compile_options(cppdap-unittests PRIVATE "/wd4244")

google/cppdap CMakeLists.txt :342

target_compile_options(cppdap-fuzzer PUBLIC "-fsanitize=fuzzer,address")

google/cppdap CMakeLists.txt :345

target_compile_options(cppdap-fuzzer PUBLIC "-fsanitize=fuzzer,memory")

google/cppdap CMakeLists.txt :348

target_compile_options(cppdap-fuzzer PUBLIC "-fsanitize=fuzzer,thread")

google/cppdap CMakeLists.txt :351

target_compile_options(cppdap-fuzzer PUBLIC "-fsanitize=fuzzer")

cp2k/dbcsr examples/CMakeLists.txt :38

target_compile_options(${dbcsr_program_name} PRIVATE ${OpenMP_CXX_FLAGS})

dftbplus/dftbplus sys/gnu-mkl-static.cmake :100

target_compile_options(OpenMP::OpenMP_Fortran INTERFACE "-fopenmp")

microsoft/DirectXMath SHMath/CMakeLists.txt :174

target_compile_options(${PROJECT_NAME} PRIVATE /Zc:__cplusplus /Zc:inline /fp:fast /Qdiag-disable:161)

microsoft/DirectXMath SHMath/CMakeLists.txt :209

target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264)

microsoft/DirectXMesh CMakeLists.txt :250

target_compile_options(${t} PRIVATE /Wall /GR-)

microsoft/DirectXMesh CMakeLists.txt :294

target_compile_options(${t} PRIVATE "/Qspectre")

microsoft/DirectXTK CMakeLists.txt :461

target_compile_options(${t} PRIVATE ${WarningsEXE})

microsoft/DirectXTK CMakeLists.txt :468

target_compile_options(${t} PRIVATE "-Wno-attributes")

davisking/dlib dlib/CMakeLists.txt :901

target_compile_options(dlib PUBLIC ${active_preprocessor_switches})

davisking/dlib dlib/CMakeLists.txt :934

target_compile_options(dlib PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${active_compile_opts}>)

doctest/doctest examples/all_features/CMakeLists.txt :145

target_compile_options(disabled PRIVATE /wd4189) # local variable is initialized but not referenced

doctest/doctest examples/all_features/CMakeLists.txt :158

target_compile_options(disabled PRIVATE -Wno-unused-variable)

doxygen/doxygen addon/doxyapp/CMakeLists.txt :25

target_compile_options(doxyapp PRIVATE -stdlib=libc++)

doxygen/doxygen cmake/Coverage.cmake :36

target_compile_options(${project_name} PRIVATE ${COVERAGE_COMPILER_FLAGS})

doxygen/doxygen deps/spdlog/CMakeLists.txt :169

target_compile_options(spdlog PUBLIC $<$<AND:$<CXX_COMPILER_ID:MSVC>,$<NOT:$<COMPILE_LANGUAGE:CUDA>>>:/wd4251
                                     /wd4275>)

doxygen/doxygen deps/spdlog/CMakeLists.txt :291

target_compile_options(spdlog_header_only INTERFACE "/Zc:__cplusplus")

doxygen/doxygen deps/spdlog/CMakeLists.txt :297

target_compile_options(spdlog_header_only
                       INTERFACE $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)

skypjack/entt CMakeLists.txt :100

target_compile_options(EnTT BEFORE INTERFACE -stdlib=libc++)

libfann/fann CMakeLists.txt :31

TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1)

libfann/fann CMakeLists.txt :34

TARGET_COMPILE_OPTIONS(${BII_LIB_TARGET} PUBLIC -DFANN_DLL_EXPORTS)

spnda/fastgltf cmake/compilers.cmake :20

target_compile_options(${TARGET} PRIVATE $<$<CONFIG:RELEASE>:-DNDEBUG>)

fastfloat/fast_float CMakeLists.txt :52

target_compile_options(fast_float INTERFACE -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all)

fastfloat/fast_float CMakeLists.txt :64

target_compile_options(fast_float INTERFACE /permissive-)

fastfloat/fast_float tests/CMakeLists.txt :58

target_compile_options(${TEST_NAME} PUBLIC -Werror -Wall -Wextra -Weffc++)

xiph/flac src/libFLAC/CMakeLists.txt :104

target_compile_options(FLAC BEFORE PRIVATE "/fp:fast")

xiph/flac src/libFLAC/CMakeLists.txt :107

target_compile_options(FLAC BEFORE PRIVATE -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math)

google/flatbuffers CMakeLists.txt :347

target_compile_options(ProjectConfig
  INTERFACE
    /W4
    $<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
      /WX       # Treat all compiler warnings as errors
    >
    /wd4512   # C4512: assignment operator could not be generated
    /wd4316   # C4316: object allocated on the heap may not be aligned
    /wd4456   # C4456: hides previous local declaration
    $<$<CXX_COMPILER_ID:Clang>:
      /D_CRT_SECURE_NO_WARNINGS
    >
)

google/flatbuffers CMakeLists.txt :361

target_compile_options(ProjectConfig
  INTERFACE
    -Wall
    $<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
      -Werror   # Treat all compiler warnings as errors

      -fno-rtti # Disable runtime type information

      $<$<CXX_COMPILER_ID:GNU>:
        # False positive string overflow
        # https://github.com/google/flatbuffers/issues/7366
        -Wno-error=stringop-overflow
      >
    >
    -pedantic
    -Wextra
    -Wno-unused-parameter
    -Wold-style-cast
    -fsigned-char
    -Wnon-virtual-dtor

    # This isn't working for some reason: $<$<CXX_COMPILER_ID:CLANG>:
    $<$<BOOL:${IS_CLANG}>:
      -Wnewline-eof
      -Wno-unknown-warning-option
      -Wmissing-declarations
      -Wzero-as-null-pointer-constant
      $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,3.8>:
        -Wimplicit-fallthrough
        -Wextra-semi
        $<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
          -Werror=unused-private-field
        >
      >
    >

    $<$<CXX_COMPILER_ID:GNU>:
      $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.4>:
        -Wunused-result
        -Wunused-parameter
        -Werror=unused-parameter
        -Wmissing-declarations
      >
      $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.7>:
        -Wzero-as-null-pointer-constant
      >
      $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,7.0>:
        -faligned-new
        $<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
          -Werror=implicit-fallthrough=2
        >
      >
      $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,8.0>:
        -Wextra-semi
      >
    >

    $<$<BOOL:${FLATBUFFERS_CODE_COVERAGE}>:
      -g
      -fprofile-arcs
      -ftest-coverage
    >
  )

google/flatbuffers benchmarks/CMakeLists.txt :70

target_compile_options(flatbenchmark
    PRIVATE
        -fno-aligned-new
        -Wno-deprecated-declarations
)

flintlib/flint CMakeLists.txt :431

target_compile_options(flint PUBLIC "-mpopcnt")

fltk/fltk zlib/CMakeLists.txt :50

target_compile_options(fltk_z PRIVATE ${msvc_warnings})

FluidSynth/fluidsynth doc/android/fluidsynth-assetloader/CMakeLists.txt :9

target_compile_options ( fluidsynth-assetloader
                        PRIVATE -v
                        PRIVATE -Wall
                        PRIVATE "$<$<CONFIG:DEBUG>:-Werror>") # Only include -Werror when building debug config

fmtlib/fmt test/add-subdirectory-test/CMakeLists.txt :15

target_compile_options(header-only-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})

facebook/folly CMake/FollyCompilerMSVC.cmake :110

target_compile_options(${THETARGET}
  PUBLIC
    /EHs # Don't catch structured exceptions with catch (...)
    /GF # There are bugs with constexpr StringPiece when string pooling is disabled.
    /Zc:referenceBinding # Disallow temporaries from binding to non-const lvalue references.
    /Zc:rvalueCast # Enforce the standard rules for explicit type conversion.
    /Zc:implicitNoexcept # Enable implicit noexcept specifications where required, such as destructors.
    /Zc:strictStrings # Don't allow conversion from a string literal to mutable characters.
    /Zc:threadSafeInit # Enable thread-safe function-local statics initialization.
    /Zc:throwingNew # Assume operator new throws on failure.

    /permissive- # Be mean, don't allow bad non-standard stuff (C++/CLI, __declspec, etc. are all left intact).
    /std:${MSVC_LANGUAGE_VERSION} # Build in the requested version of C++
    /utf-8 # fmt needs unicode support, which requires compiling with /utf-8

  PRIVATE
    /bigobj # Support objects with > 65k sections. Needed due to templates.
    /favor:${MSVC_FAVORED_ARCHITECTURE} # Architecture to prefer when generating code.
    /Zc:inline # Have the compiler eliminate unreferenced COMDAT functions and data before emitting the object file.

    $<$<BOOL:${MSVC_ENABLE_ALL_WARNINGS}>:/Wall> # Enable all warnings if requested.
    $<$<BOOL:${MSVC_ENABLE_PARALLEL_BUILD}>:/MP> # Enable multi-processor compilation if requested.
    $<$<BOOL:${MSVC_ENABLE_STATIC_ANALYSIS}>:/analyze> # Enable static analysis if requested.

    # Debug builds
    $<$<CONFIG:DEBUG>:
      /Gy- # Disable function level linking.

      $<$<BOOL:${MSVC_ENABLE_DEBUG_INLINING}>:/Ob2> # Add /Ob2 if allowing inlining in debug mode.
    >

    # Non-debug builds
    $<$<NOT:$<CONFIG:DEBUG>>:
      /Gw # Optimize global data. (-fdata-sections)
      /Gy # Enable function level linking. (-ffunction-sections)
      /Qpar # Enable parallel code generation.
      /Oi # Enable intrinsic functions.
      /Ot # Favor fast code.

      $<$<BOOL:${MSVC_ENABLE_LTCG}>:/GL> # Enable link time code generation.
    >
)

OSGeo/gdal autotest/cpp/CMakeLists.txt :142

target_compile_options(gdal_unit_test PRIVATE -O0)

OSGeo/gdal autotest/cpp/CMakeLists.txt :293

target_compile_options(testssse3 PRIVATE ${GDAL_SSSE3_FLAG})

OSGeo/gdal autotest/cpp/CMakeLists.txt :295

target_compile_options(testavx2 PRIVATE ${GDAL_AVX2_FLAG})

OSGeo/gdal cmake/helpers/GdalDriverHelper.cmake :385

target_compile_options(${_TARGET} PRIVATE ${_res})

OSGeo/gdal cmake/helpers/GdalTestTarget.cmake :8

target_compile_options(${_target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${GDAL_CXX_WARNING_FLAGS}>
                                          $<$<COMPILE_LANGUAGE:C>:${GDAL_C_WARNING_FLAGS}>)

OSGeo/gdal frmts/gtiff/libtiff/CMakeLists.txt :98

target_compile_options(libtiff_jpeg PRIVATE /wd4324)

OSGeo/gdal frmts/zlib/CMakeLists.txt :27

target_compile_options(libz PRIVATE ${GDAL_C_WARNING_FLAGS})

OSGeo/gdal ogr/ogrsf_frmts/generic/CMakeLists.txt :47

target_compile_options(ogrsf_generic PRIVATE ${GDAL_CXX_WARNING_FLAGS} ${WFLAG_OLD_STYLE_CAST} ${WFLAG_EFFCXX})

OSGeo/gdal port/CMakeLists.txt :114

target_compile_options(cpl PRIVATE ${GDAL_CXX_WARNING_FLAGS} ${WFLAG_OLD_STYLE_CAST} ${WFLAG_EFFCXX})

libgeos/geos CMakeLists.txt :297

target_compile_options(geos_developer_cxx_flags
  INTERFACE
    $<$<CXX_COMPILER_ID:MSVC>:-W4>  # consider -analyze
    $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Werror -pedantic -Wall -Wextra -Wno-long-long -Wcast-align -Wconversion -Wsign-conversion -Wchar-subscripts -Wdouble-promotion -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wuninitialized -Wunused-parameter -fno-common>
    $<$<CXX_COMPILER_ID:GNU>:-fno-implicit-inline-templates -Wno-psabi -Wsuggest-attribute=format>
    $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-unknown-warning-option>
    )

libgeos/geos CMakeLists.txt :306

target_compile_options(geos_developer_cxx_flags INTERFACE -Wsuggest-override)