diff options
author | sfan5 <sfan5@live.de> | 2021-08-19 19:21:33 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-08-21 13:53:59 +0200 |
commit | a72d13064fcbddaf332c7d53e6f34b74d8781586 (patch) | |
tree | 828f233cd22bba0377c5a9d5186cf4239aff3386 | |
parent | 6fd8aede48e357524ea0723fd0e8836697ece11e (diff) | |
download | minetest-a72d13064fcbddaf332c7d53e6f34b74d8781586.tar.gz minetest-a72d13064fcbddaf332c7d53e6f34b74d8781586.tar.bz2 minetest-a72d13064fcbddaf332c7d53e6f34b74d8781586.zip |
Allow lib/irrlichtmt to work for server builds (headers-only)
-rw-r--r-- | CMakeLists.txt | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fe508ffdb..9cb5678c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,19 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # This is done here so that relative search paths are more reasonable if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt") message(STATUS "Using user-provided IrrlichtMt at subdirectory 'lib/irrlichtmt'") - # tell IrrlichtMt to create a static library - set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE) - add_subdirectory(lib/irrlichtmt EXCLUDE_FROM_ALL) - unset(BUILD_SHARED_LIBS CACHE) - - if(NOT TARGET IrrlichtMt) - message(FATAL_ERROR "IrrlichtMt project is missing a CMake target?!") + if(BUILD_CLIENT) + # tell IrrlichtMt to create a static library + set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE) + add_subdirectory(lib/irrlichtmt EXCLUDE_FROM_ALL) + unset(BUILD_SHARED_LIBS CACHE) + + if(NOT TARGET IrrlichtMt) + message(FATAL_ERROR "IrrlichtMt project is missing a CMake target?!") + endif() + else() + add_library(IrrlichtMt::IrrlichtMt INTERFACE IMPORTED) + target_include_directories(IrrlichtMt::IrrlichtMt INTERFACE + "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt/include") endif() else() find_package(IrrlichtMt QUIET) |