Add CMake options to disable various dependencies.
Actually doing so will cause compile errors until the sources are updated.
@@ -28,12 +28,14 @@ else()
message(FATAL_ERROR "Unknown option for LIBTCOD_SDL2: '${LIBTCOD_SDL2}'")
endif()
-set_property(CACHE LIBTCOD_ZLIB PROPERTY STRINGS "find_package" "conan")
+set_property(CACHE LIBTCOD_ZLIB PROPERTY STRINGS "find_package" "conan" "disable")
if(LIBTCOD_ZLIB STREQUAL "find_package")
find_package(ZLIB REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB)
elseif(LIBTCOD_ZLIB STREQUAL "conan")
target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::zlib)
+elseif(LIBTCOD_ZLIB STREQUAL "disable")
+ target_compile_definitions(${PROJECT_NAME} PUBLIC TCOD_NO_ZLIB)
else()
message(FATAL_ERROR "Unknown option for LIBTCOD_ZLIB: '${LIBTCOD_ZLIB}'")
endif()
@@ -54,7 +56,7 @@ if(NOT LIBTCOD_SDL2 STREQUAL "disable") # Ignore GLAD if SDL is disabled.
endif()
set(LIBTCOD_LODEPNG "find_package" CACHE STRING "How this library will be linked.")
-set_property(CACHE LIBTCOD_LODEPNG PROPERTY STRINGS "vendored" "find_package")
+set_property(CACHE LIBTCOD_LODEPNG PROPERTY STRINGS "vendored" "find_package" "disable")
if(LIBTCOD_LODEPNG STREQUAL "find_package")
find_package(lodepng-c CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE lodepng-c)
@@ -62,12 +64,14 @@ elseif(LIBTCOD_LODEPNG STREQUAL "vendored")
message("Will be vendored: LodePNG")
target_sources(${PROJECT_NAME} PRIVATE "vendor/lodepng.c")
target_include_directories(${PROJECT_NAME} PRIVATE "vendor/")
+elseif(LIBTCOD_LODEPNG STREQUAL "disable")
+ target_compile_definitions(${PROJECT_NAME} PUBLIC TCOD_NO_PNG)
else()
message(FATAL_ERROR "Unknown option for LIBTCOD_LODEPNG: '${LIBTCOD_LODEPNG}'")
endif()
set(LIBTCOD_UTF8PROC "vcpkg" CACHE STRING "How this library will be linked.")
-set_property(CACHE LIBTCOD_UTF8PROC PROPERTY STRINGS "vendored" "vcpkg")
+set_property(CACHE LIBTCOD_UTF8PROC PROPERTY STRINGS "vendored" "vcpkg" "disable")
if(LIBTCOD_UTF8PROC STREQUAL "vendored")
message("Will be vendored: utf8proc")
target_include_directories(${PROJECT_NAME} PRIVATE "vendor/utf8proc")
@@ -86,6 +90,8 @@ elseif (LIBTCOD_UTF8PROC STREQUAL "vcpkg")
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${UTF8PROC_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${UTF8PROC_LIBRARY})
+elseif(LIBTCOD_UTF8PROC STREQUAL "disable")
+ target_compile_definitions(${PROJECT_NAME} PUBLIC TCOD_NO_UTF8)
else()
message(FATAL_ERROR "Unknown option for LIBTCOD_UTF8PROC: '${LIBTCOD_UTF8PROC}'")
endif()
