Skip to content
Snippets Groups Projects
Select Git revision
  • 53704c9694d39bb4e013c5126329ec5a2c61e679
  • master default protected
2 results

shared_settings.cmake

Blame
  • shared_settings.cmake 912 B
    # This file defines an interface library used to add common compile flags to all targets.
    
    add_library(shared_settings INTERFACE)
    
    # Warning flags
    target_compile_options(shared_settings INTERFACE
        -Wall
        -Wcast-align
        -Wcast-qual
        -Wextra
        -Wundef
        -Wuseless-cast
        -Wzero-as-null-pointer-constant
        -pedantic
    )
    
    # Speed flags
    target_compile_options(shared_settings INTERFACE -march=native -ffast-math)
    
    # Build type for profile generation
    target_compile_options(shared_settings INTERFACE $<$<CONFIG:ProfileGenerate>:
        -fprofile-generate
        -O3
        -DNDEBUG
    >)
    target_link_options(shared_settings INTERFACE $<$<CONFIG:ProfileGenerate>:-fprofile-generate>)
    
    # Build type for profile use
    target_compile_options(shared_settings INTERFACE $<$<CONFIG:ProfileUse>:
        -fprofile-use
        -O3
        -DNDEBUG
    >)
    target_link_options(shared_settings INTERFACE $<$<CONFIG:ProfileUse>:-fprofile-use>)