diff --git a/CMakeLists.txt b/CMakeLists.txt index 5350215ad..2859e425a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,13 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets") project( leptonica - LANGUAGES C CXX + LANGUAGES C VERSION 1.84.0) +set(CMAKE_C_STANDARD 17) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# Standard installation paths +include(GNUInstallDirs) set(MINIMUM_WEBPMUX_VERSION 0.5.0) diff --git a/prog/CMakeLists.txt b/prog/CMakeLists.txt index be82d8c64..61b1e9522 100644 --- a/prog/CMakeLists.txt +++ b/prog/CMakeLists.txt @@ -3,10 +3,12 @@ ######################################## function(add_prog_target target) set (${target}_src "${ARGN}") - if (WIN32) - set_source_files_properties (${${target}_src} PROPERTIES LANGUAGE CXX) - endif() add_executable (${target} ${${target}_src}) + string(FIND ${target} "gif" GIF_TEST_FOUND) + if (GIF_TEST_FOUND EQUAL 0) + # gif_lib.h is not found on Windows + target_include_directories (${target} PRIVATE ${GIF_INCLUDE_DIR}) + endif() if (BUILD_SHARED_LIBS) target_compile_definitions (${target} PRIVATE -DLIBLEPT_IMPORTS) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 651185087..e8bf771e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,9 +10,6 @@ file(GLOB hdr "*.h") file(GLOB src "*.c") -if (MSVC) - set_source_files_properties(${src} PROPERTIES LANGUAGE CXX) -endif() string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") @@ -73,6 +70,10 @@ if (UNIX) endif(SYM_LINK) endif() +if (MSVC) + target_link_libraries (leptonica PRIVATE user32.lib gdi32.lib) +endif() + if (NOT SW_BUILD) export(TARGETS leptonica FILE ${CMAKE_BINARY_DIR}/LeptonicaTargets.cmake) else()