Set library scope and move target properties after the target.
@@ -2,10 +2,6 @@ cmake_minimum_required (VERSION 3.9)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
-if(IPO_SUPPORTED)
- set_property(TARGET TCOD PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
- set_property(TARGET TCOD PROPERTY INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE)
-endif()
project (libtcod C CXX)
@@ -15,7 +11,8 @@ conan_basic_setup(TARGETS)
add_library(TCOD)
add_library(TCOD::TCOD ALIAS TCOD)
target_compile_features(TCOD PUBLIC cxx_std_14)
-target_link_libraries(TCOD CONAN_PKG::sdl2 CONAN_PKG::zlib)
+target_link_libraries(TCOD PUBLIC CONAN_PKG::sdl2)
+target_link_libraries(TCOD PRIVATE CONAN_PKG::zlib)
target_include_directories(TCOD PUBLIC ./)
target_include_directories(TCOD PRIVATE ./vendor)
@@ -33,3 +30,8 @@ endif()
target_compile_definitions(TCOD PRIVATE TCOD_IGNORE_DEPRECATED)
include(sources.cmake)
+
+if(IPO_SUPPORTED)
+ set_property(TARGET TCOD PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
+ set_property(TARGET TCOD PROPERTY INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE)
+endif()
