Skip to content

Commit

Permalink
Cleanup enabling IPO in CMake (#4776)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt authored Aug 30, 2024
1 parent c4d07ea commit 416df19
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 21 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,12 @@ add_executable(tfs ${tfs_MAIN})
target_link_libraries(tfs tfslib)

### INTERPROCEDURAL_OPTIMIZATION ###
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT error)
if (result)
set(ENABLE_IPO ON)
set_target_properties(tfs PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
message(STATUS "IPO / LTO enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else ()
message(STATUS "IPO / LTO not supported: <${error}>")
message(STATUS "IPO is not supported: ${error}")
endif ()
### END INTERPROCEDURAL_OPTIMIZATION ###

Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ if (APPLE)
target_link_libraries(tfslib PRIVATE Iconv::Iconv)
endif()

if (ENABLE_IPO)
set_target_properties(tfslib PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
endif()

if (HTTP)
add_subdirectory(http)
target_link_libraries(tfslib PRIVATE http)
Expand Down
4 changes: 0 additions & 4 deletions src/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ add_library(http OBJECT ${http_SRC})
target_link_libraries(http PRIVATE Boost::json)
set_target_properties(http PROPERTIES UNITY_BUILD ${ENABLE_UNITY_BUILD})

if (ENABLE_IPO)
set_target_properties(http PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
endif()

if (BUILD_TESTING)
add_subdirectory(tests)
endif()
4 changes: 0 additions & 4 deletions src/http/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@ foreach(test_src ${tests_SRC})
add_executable(${test_name} ${test_src})
target_link_libraries(${test_name} PRIVATE http tfslib Boost::unit_test_framework)

if (ENABLE_IPO)
set_target_properties(${test_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
endif()

add_test(NAME ${test_name} COMMAND ${test_name})
endforeach()
4 changes: 0 additions & 4 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,5 @@ foreach(test_src ${tests_SRC})
add_executable(${test_name} ${test_src})
target_link_libraries(${test_name} PRIVATE tfslib Boost::unit_test_framework)

if (ENABLE_IPO)
set_target_properties(${test_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
endif()

add_test(NAME ${test_name} COMMAND ${test_name})
endforeach()

0 comments on commit 416df19

Please sign in to comment.