diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index 6e6b161e..e53705e7 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -64,8 +64,7 @@ else() find_package(X11 REQUIRED) endif() -# Includes for object libraries. -include_directories( +set(link_includes "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}" @@ -81,7 +80,6 @@ include_directories( ${X11_INCLUDE_DIR} ) -# Libraries for object libraries. set(link_libs "${ZLIB_LIBRARY}" "${JPEG_LIBRARY}" @@ -100,7 +98,6 @@ set(link_libs ${X11_X11_LIB} ${X11_Xxf86vm_LIB} ) -link_libraries(${link_libs}) # Source files @@ -401,18 +398,15 @@ add_library(IRRGUIOBJ OBJECT option(BUILD_SHARED_LIBS "Build shared library" TRUE) -# IrrlichtMt target -add_library(IrrlichtMt - $ - $ - $ - $ - $ - $ - $ - $ - $ -) +add_library(IrrlichtMt) +foreach(object_lib + IRRMESHOBJ IRROBJ IRRPARTICLEOBJ IRRANIMOBJ IRRVIDEOOBJ IRRSWRENDEROBJ + IRRIOOBJ IRROTHEROBJ IRRGUIOBJ) + # Set include directories for object library compilation + target_include_directories(${object_lib} PRIVATE ${link_includes}) + # Add objects from object library to main library + target_sources(IrrlichtMt PRIVATE $) +endforeach() # Alias target provides add_submodule compatibility add_library(IrrlichtMt::IrrlichtMt ALIAS IrrlichtMt) @@ -423,16 +417,7 @@ target_include_directories(IrrlichtMt "$" "$" PRIVATE - "${ZLIB_INCLUDE_DIR}" - "${JPEG_INCLUDE_DIR}" - "${PNG_INCLUDE_DIR}" - - ${OPENGL_INCLUDE_DIR} - ${OPENGLES2_INCLUDE_DIR} - ${EGL_INCLUDE_DIR} - - "$<$:${ANDROID_NDK}/sources/android/native_app_glue>" - ${X11_INCLUDE_DIR} + ${link_includes} ) target_link_libraries(IrrlichtMt PRIVATE ${link_libs})