mirror of
https://github.com/polybar/polybar.git
synced 2024-11-25 13:55:47 -05:00
cmake: MinSizeRel flags
This commit is contained in:
parent
f52a3c1389
commit
989e4c3039
2 changed files with 9 additions and 0 deletions
|
@ -21,10 +21,16 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g2")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g2")
|
||||||
|
|
||||||
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||||
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fdata-sections -ffunction-sections")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -Wl,--gc-sections,--icf=safe")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Check compiler
|
# Check compiler
|
||||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0")
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0")
|
||||||
|
|
|
@ -141,6 +141,7 @@ make_executable(${PROJECT_NAME} SOURCES
|
||||||
target_link_libraries(${PROJECT_NAME} Threads::Threads)
|
target_link_libraries(${PROJECT_NAME} Threads::Threads)
|
||||||
|
|
||||||
target_compile_options(${PROJECT_NAME} PUBLIC
|
target_compile_options(${PROJECT_NAME} PUBLIC
|
||||||
|
$<$<CXX_COMPILER_ID:GNU>:$<$<CONFIG:MinSizeRel>:-flto>>
|
||||||
${X11_Xft_DEFINITIONS}
|
${X11_Xft_DEFINITIONS}
|
||||||
${X11_XCB_DEFINITIONS}
|
${X11_XCB_DEFINITIONS}
|
||||||
${XCB_DEFINITIONS})
|
${XCB_DEFINITIONS})
|
||||||
|
@ -150,6 +151,8 @@ target_compile_options(${PROJECT_NAME} PUBLIC
|
||||||
|
|
||||||
if(BUILD_IPC_MSG)
|
if(BUILD_IPC_MSG)
|
||||||
make_executable(${PROJECT_NAME}-msg SOURCES ipc.cpp utils/file.cpp)
|
make_executable(${PROJECT_NAME}-msg SOURCES ipc.cpp utils/file.cpp)
|
||||||
|
target_compile_options(${PROJECT_NAME}-msg PUBLIC
|
||||||
|
$<$<CXX_COMPILER_ID:GNU>:$<$<CONFIG:MinSizeRel>:-flto>>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Loading…
Reference in a new issue