Standardize CMake file.
Adds a proper alias for the library and uses targets for compile
definitions.
@@ -13,6 +13,7 @@ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
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)
@@ -20,15 +21,15 @@ target_include_directories(TCOD PUBLIC ./)
target_include_directories(TCOD PRIVATE ./vendor)
if(BUILD_SHARED_LIBS)
- add_compile_definitions(LIBTCOD_EXPORTS)
+ target_compile_definitions(TCOD PRIVATE LIBTCOD_EXPORTS)
else()
- add_compile_definitions(LIBTCOD_STATIC)
+ target_compile_definitions(TCOD PUBLIC LIBTCOD_STATIC)
endif()
if(MSVC)
- add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
+ target_compile_definitions(TCOD PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
-add_compile_definitions(TCOD_IGNORE_DEPRECATED)
+target_compile_definitions(TCOD PRIVATE TCOD_IGNORE_DEPRECATED)
include(sources.cmake)
