]> git.lizzy.rs Git - irrlicht.git/commitdiff
Improve IrrCompileConfig handling in cmake
authorsfan5 <sfan5@live.de>
Sat, 21 May 2022 12:26:52 +0000 (14:26 +0200)
committersfan5 <sfan5@live.de>
Sat, 21 May 2022 13:26:38 +0000 (15:26 +0200)
source/Irrlicht/CMakeLists.txt

index b2e53eeececc900c3779e34726239bfe0fe58d6b..21e997792f239978308b59c6b99134e12483aada 100644 (file)
@@ -48,8 +48,7 @@ find_package(ZLIB REQUIRED)
 find_package(JPEG REQUIRED)
 find_package(PNG REQUIRED)
 
-# To configure the features available in this Irrlicht build please edit
-# include/IrrCompileConfig.h and re-run CMake from a clean state
+# To configure the features available in this Irrlicht build please edit include/IrrCompileConfig.h.
 include(CheckSymbolExists)
 set(CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/include)
 unset(OGLES1_ENABLED CACHE)
@@ -58,6 +57,9 @@ unset(OGL_ENABLED CACHE)
 unset(XINPUT2_ENABLED CACHE)
 unset(SDL_ENABLED CACHE)
 
+# tell cmake about the dependency
+set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_REQUIRED_INCLUDES}/IrrCompileConfig.h)
+
 check_symbol_exists(_IRR_COMPILE_WITH_OGLES1_ "IrrCompileConfig.h" OGLES1_ENABLED)
 if(OGLES1_ENABLED)
        # only tested on Android, probably works on Linux (is this needed anywhere else?)
@@ -75,11 +77,12 @@ if(OGL_ENABLED)
        set(OpenGL_GL_PREFERENCE "LEGACY")
        find_package(OpenGL REQUIRED)
 endif()
-check_symbol_exists(_IRR_LINUX_X11_XINPUT2_ "IrrCompileConfig.h" XINPUT2_ENABLED)
-if(XINPUT2_ENABLED)
-       find_library(XINPUT_LIBRARY Xi REQUIRED)
+if(NOT ANDROID AND NOT APPLE)
+       check_symbol_exists(_IRR_LINUX_X11_XINPUT2_ "IrrCompileConfig.h" XINPUT2_ENABLED)
+       if(XINPUT2_ENABLED)
+               find_library(XINPUT_LIBRARY Xi REQUIRED)
+       endif()
 endif()
-
 check_symbol_exists(_IRR_COMPILE_WITH_SDL_DEVICE_ "IrrCompileConfig.h" SDL_ENABLED)
 if(SDL_ENABLED)
        find_package(SDL2 CONFIG REQUIRED)