Skip to content

Commit

Permalink
CMake: refactor targets to use target_include_directories
Browse files Browse the repository at this point in the history
these automatically propagate through the build and are also exported to
the package.
At this also fix the CMake export target generation and use it.
  • Loading branch information
paroj committed Apr 8, 2018
1 parent d35e3e7 commit 9c2055e
Show file tree
Hide file tree
Showing 36 changed files with 145 additions and 262 deletions.
1 change: 1 addition & 0 deletions CMake/InstallResources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,4 @@ install(FILES
${OGRE_BINARY_DIR}/cmake/OGREConfigVersion.cmake
DESTINATION ${OGRE_CMAKE_DIR}
)
install(EXPORT OgreTargets DESTINATION ${OGRE_CMAKE_DIR})
33 changes: 9 additions & 24 deletions CMake/Templates/OGREConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
#
# This module defines
# OGRE_INCLUDE_DIRS - the OGRE include directories
# OGRE_LIBRARIES - link these to use the OGRE core
# OGRE_LIBRARIES - link these to use the OGRE
# OGRE_LIBRARY_DIRS, the location of the libraries
# OGRE_STATIC - whther ogre was build as static lib
# OGRE_${COMPONENT}_FOUND - ${COMPONENT} is available
# OGRE_${COMPONENT}_INCLUDE_DIRS - additional include directories for ${COMPONENT}
# OGRE_${COMPONENT}_LIBRARIES - link these to use ${COMPONENT}
# OGRE_${COMPONENT}_LIBRARIES - link these to only use ${COMPONENT}
# OGRE_PLUGIN_DIR - The directory where the OGRE plugins are located
# OGRE_MEDIA_DIR - The directory where the OGRE sample media is located
# OGRE_CONFIG_DIR - The directory where the OGRE config files are located
Expand All @@ -31,10 +30,6 @@ set(OGRE_CONFIG_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@OGRE_CFG_INSTALL_PATH@")
set(OGRE_PREFIX_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@")
get_filename_component(OGRE_LIBRARY_DIRS "${OGRE_PREFIX_DIR}/lib" ABSOLUTE)
get_filename_component(OGRE_INCLUDE_DIRS "${OGRE_PREFIX_DIR}/include/OGRE" ABSOLUTE)
if(APPLE AND NOT APPLE_IOS)
# Note: OGRE_INCLUDE_DIRS is not yet a list
list(APPEND OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS}/OSX)
endif()
set(OGRE_LIBRARIES)

cmake_policy(PUSH)
Expand All @@ -51,38 +46,28 @@ set(OGRE_PLUGINS)

macro(ogre_declare_component COMPONENT)
set(OGRE_${COMPONENT}_FOUND TRUE)
set(OGRE_${COMPONENT}_INCLUDE_DIRS "${OGRE_PREFIX_DIR}/include/OGRE/${COMPONENT}")
set(OGRE_${COMPONENT}_LIBRARIES "Ogre${COMPONENT}@OGRE_LIB_SUFFIX@")
set(OGRE_${COMPONENT}_LIBRARIES Ogre${COMPONENT}) # backwards compatibility

list(APPEND OGRE_COMPONENTS ${COMPONENT})

list(APPEND OGRE_INCLUDE_DIRS ${OGRE_${COMPONENT}_INCLUDE_DIRS})
list(APPEND OGRE_LIBRARIES ${OGRE_${COMPONENT}_LIBRARIES})
list(APPEND OGRE_LIBRARIES Ogre${COMPONENT})
endmacro()

macro(ogre_declare_plugin TYPE COMPONENT)
set(OGRE_${TYPE}_${COMPONENT}_FOUND TRUE)
set(OGRE_${TYPE}_${COMPONENT}_INCLUDE_DIRS "${OGRE_PREFIX_DIR}/include/OGRE/${TYPE}s/${COMPONENT}")
set(OGRE_${TYPE}_${COMPONENT}_LIBRARIES "${TYPE}_${COMPONENT}@OGRE_LIB_SUFFIX@")
set(OGRE_${TYPE}_${COMPONENT}_LIBRARIES ${TYPE}_${COMPONENT})

if(@OGRE_STATIC@)
list(APPEND OGRE_LIBRARIES ${OGRE_${TYPE}_${COMPONENT}_LIBRARIES})
list(APPEND OGRE_LIBRARIES ${TYPE}_${COMPONENT})
endif()

list(APPEND OGRE_PLUGINS ${TYPE}_${COMPONENT})
endmacro()

## COMPONENTS
include("${CMAKE_CURRENT_LIST_DIR}/OgreTargets.cmake")

if(@OGRE_BUILD_COMPONENT_BITES@)
ogre_declare_component(Bites)

if(@SDL2_FOUND@)
list(APPEND OGRE_Bites_INCLUDE_DIRS @SDL2_INCLUDE_DIR@)
list(APPEND OGRE_Bites_LIBRARIES @SDL2_LIBRARY@)

list(APPEND OGRE_INCLUDE_DIRS @SDL2_INCLUDE_DIR@)
list(APPEND OGRE_LIBRARIES "@SDL2_LIBRARY@")
endif()
endif()
if(@OGRE_BUILD_COMPONENT_HLMS@)
ogre_declare_component(HLMS)
Expand Down Expand Up @@ -157,7 +142,7 @@ if(@OGRE_STATIC@)
endif()

# must come last in case of static build
list(APPEND OGRE_LIBRARIES "OgreMain@OGRE_LIB_SUFFIX@")
list(APPEND OGRE_LIBRARIES OgreMain)

if(NOT OGRE_FIND_QUIETLY)
message(STATUS "Found OGRE")
Expand Down
32 changes: 8 additions & 24 deletions CMake/Utils/OgreConfigTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,58 +100,51 @@ function(ogre_install_target TARGETNAME SUFFIX EXPORT)
endif()

if(EXPORT)
install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports
install(TARGETS ${TARGETNAME} EXPORT OgreTargets
BUNDLE DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
RUNTIME DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELEASE_PATH}/Release" CONFIGURATIONS Release None ""
)
install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports

BUNDLE DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
RUNTIME DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELWDBG_PATH}/RelWithDebInfo" CONFIGURATIONS RelWithDebInfo
)
install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports

BUNDLE DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
RUNTIME DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_MINSIZE_PATH}/MinSizeRel" CONFIGURATIONS MinSizeRel
)
install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports

BUNDLE DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
RUNTIME DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_DEBUG_PATH}/Debug" CONFIGURATIONS Debug
)
#install(EXPORT Ogre-exports DESTINATION ${OGRE_LIB_DIRECTORY})
else()
install(TARGETS ${TARGETNAME}
BUNDLE DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
RUNTIME DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELEASE_PATH}/Release" CONFIGURATIONS Release None ""
)
install(TARGETS ${TARGETNAME}

BUNDLE DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
RUNTIME DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELWDBG_PATH}/RelWithDebInfo" CONFIGURATIONS RelWithDebInfo
)
install(TARGETS ${TARGETNAME}

BUNDLE DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
RUNTIME DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_MINSIZE_PATH}/MinSizeRel" CONFIGURATIONS MinSizeRel
)
install(TARGETS ${TARGETNAME}

BUNDLE DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
RUNTIME DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug
Expand Down Expand Up @@ -236,7 +229,7 @@ function(ogre_config_lib LIBNAME EXPORT)
endfunction(ogre_config_lib)

function(ogre_config_component LIBNAME)
ogre_config_lib(${LIBNAME} FALSE)
ogre_config_lib(${LIBNAME} TRUE)
if (OGRE_PROJECT_FOLDERS)
set_property(TARGET ${LIBNAME} PROPERTY FOLDER Components)
endif ()
Expand Down Expand Up @@ -456,12 +449,3 @@ function(ogre_config_tool TOOLNAME)
endif ()

endfunction(ogre_config_tool)

# Get component include dir (different when referencing SDK)
function(ogre_add_component_include_dir COMPONENTNAME)
if (OGRE_SDK_BUILD)
include_directories("${OGRE_INCLUDE_DIR}/${COMPONENTNAME}")
else()
include_directories("${OGRE_SOURCE_DIR}/Components/${COMPONENTNAME}/include")
endif()
endfunction(ogre_add_component_include_dir)
34 changes: 9 additions & 25 deletions Components/Bites/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,8 @@ if(EMSCRIPTEN)
endif()

if (OGRE_STATIC)
# Static linking means we need to directly use plugins
include_directories(${OGRE_SOURCE_DIR}/PlugIns/BSPSceneManager/include)
include_directories(${OGRE_SOURCE_DIR}/PlugIns/CgProgramManager/include)
include_directories(${OGRE_SOURCE_DIR}/PlugIns/OctreeSceneManager/include)
include_directories(${OGRE_SOURCE_DIR}/PlugIns/OctreeZone/include)
include_directories(${OGRE_SOURCE_DIR}/PlugIns/ParticleFX/include)
include_directories(${OGRE_SOURCE_DIR}/PlugIns/PCZSceneManager/include)
include_directories(${OGRE_SOURCE_DIR}/PlugIns/STBICodec/include)
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/Direct3D9/include ${DirectX9_INCLUDE_DIR})
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/Direct3D11/include)
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/GLES/include)
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/GLES2/include)
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/GLSupport/include)
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/GL/include)
include_directories(${OGRE_SOURCE_DIR}/RenderSystems/GL3Plus/include)

# Link to all enabled plugins
if (OGRE_BUILD_PLUGIN_OCTREE)
Expand Down Expand Up @@ -77,11 +64,6 @@ if (OGRE_STATIC)
endif ()
endif ()

if (OGRE_BUILD_COMPONENT_RTSHADERSYSTEM)
ogre_add_component_include_dir(RTShaderSystem)
set(DEPENDENCIES ${DEPENDENCIES} OgreRTShaderSystem)
endif ()

# define header and source files for the library
file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
list(APPEND HEADER_FILES ${CMAKE_BINARY_DIR}/include/OgreBitesPrerequisites.h)
Expand Down Expand Up @@ -125,23 +107,25 @@ elseif(UNIX)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/misc/GLX_backdrop.png" DESTINATION "share/OGRE/")
endif()

# include headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
ogre_add_component_include_dir(Overlay)

# setup target
add_library(OgreBites ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCES})
set_target_properties(OgreBites PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreBites OgreMain OgreOverlay ${DEPENDENCIES})
target_link_libraries(OgreBites PUBLIC OgreMain OgreOverlay PRIVATE ${DEPENDENCIES})
if (OGRE_BUILD_COMPONENT_RTSHADERSYSTEM)
target_link_libraries(OgreBites PUBLIC OgreRTShaderSystem)
endif ()
target_include_directories(OgreBites PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/Bites>)

if(OGRE_STATIC AND APPLE AND OGRE_BUILD_PLUGIN_CG)
# workaround so the Cg framework is found in the above condition
target_include_directories(OgreBites PUBLIC ${Cg_INCLUDE_DIRS})
endif()

if(SDL2_FOUND)
target_include_directories(OgreBites PUBLIC ${SDL2_INCLUDE_DIR})
target_link_libraries(OgreBites ${SDL2_LIBRARY})
target_include_directories(OgreBites PRIVATE ${SDL2_INCLUDE_DIR})
target_link_libraries(OgreBites PRIVATE ${SDL2_LIBRARY})
endif()

generate_export_header(OgreBites
Expand Down
11 changes: 4 additions & 7 deletions Components/HLMS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
# Add needed definitions
add_definitions(-DOGRE_HLMS_EXPORTS)

# include headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# setup target
add_library(OgreHLMS ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreHLMS PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreHLMS OgreMain)
if (OGRE_CONFIG_THREADS)
target_link_libraries(OgreHLMS ${OGRE_THREAD_LIBRARIES})
endif ()
target_link_libraries(OgreHLMS PUBLIC OgreMain)
target_include_directories(OgreHLMS PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/HLMS>)

generate_export_header(OgreHLMS
EXPORT_MACRO_NAME _OgreHlmsExport
Expand Down
3 changes: 0 additions & 3 deletions Components/Java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ set_source_files_properties(../../OgreMain/include/Ogre.i PROPERTIES CPLUSPLUS O
set(SWIG_INPUT_MODULES ../../OgreMain/include/Ogre.i)

if(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM)
ogre_add_component_include_dir(RTShaderSystem)
set_source_files_properties(../RTShaderSystem/include/OgreRTShader.i PROPERTIES CPLUSPLUS ON)
list(APPEND SWIG_INPUT_MODULES ../RTShaderSystem/include/OgreRTShader.i)
endif()

if(OGRE_BUILD_COMPONENT_OVERLAY)
ogre_add_component_include_dir(Overlay)
set_source_files_properties(../Overlay/include/OgreOverlay.i PROPERTIES CPLUSPLUS ON)
list(APPEND SWIG_INPUT_MODULES ../Overlay/include/OgreOverlay.i)
endif()
Expand All @@ -62,7 +60,6 @@ if(OGRE_BUILD_COMPONENT_BITES)
include_directories(${SDL2_INCLUDE_DIR})
endif()

ogre_add_component_include_dir(Bites)
set_source_files_properties(../Bites/include/OgreBites.i PROPERTIES CPLUSPLUS ON)

if(ANDROID)
Expand Down
18 changes: 8 additions & 10 deletions Components/MeshLodGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
# Add needed definitions
add_definitions(-DOGRE_MESHLODGENERATOR_EXPORTS ${OGRE_VISIBILITY_FLAGS})

# include headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# repeat for PCH
include_directories("${OGRE_SOURCE_DIR}/OgreMain/include" "${OGRE_BINARY_DIR}/include")

# setup target
get_native_precompiled_header(OgreMeshLodGenerator)
add_library(OgreMeshLodGenerator ${OGRE_COMP_LIB_TYPE} ${OgreMeshLodGenerator_pch} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreMeshLodGenerator PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreMeshLodGenerator OgreMain)
add_native_precompiled_header(OgreMeshLodGenerator "${CMAKE_CURRENT_SOURCE_DIR}/src/OgreMeshLodPrecompiledHeaders.h")
target_link_libraries(OgreMeshLodGenerator PUBLIC OgreMain)

if (OGRE_CONFIG_THREADS)
target_link_libraries(OgreMeshLodGenerator ${OGRE_THREAD_LIBRARIES})
endif ()
target_include_directories(OgreMeshLodGenerator PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/MeshLodGenerator>)

# repeat for PCH
include_directories("${OGRE_SOURCE_DIR}/OgreMain/include" "${OGRE_BINARY_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/include")
add_native_precompiled_header(OgreMeshLodGenerator "${CMAKE_CURRENT_SOURCE_DIR}/src/OgreMeshLodPrecompiledHeaders.h")

# install
ogre_config_framework(OgreMeshLodGenerator)
Expand Down
18 changes: 5 additions & 13 deletions Components/Overlay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,14 @@ file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
list(APPEND HEADER_FILES ${CMAKE_BINARY_DIR}/include/OgreOverlayPrerequisites.h)
file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

# workaround Wundef in freetype
if(UNIX)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/OgreFont.cpp" PROPERTIES COMPILE_FLAGS "-Wno-undef")
endif()

# include headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${FREETYPE_INCLUDE_DIRS})

# setup target
add_library(OgreOverlay ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreOverlay PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreOverlay OgreMain ${FREETYPE_LIBRARIES})
if (OGRE_CONFIG_THREADS)
target_link_libraries(OgreOverlay ${OGRE_THREAD_LIBRARIES})
endif ()
target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE "${FREETYPE_LIBRARIES}" "${ZLIB_LIBRARIES}")
target_include_directories(OgreOverlay PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/Overlay>
PRIVATE ${FREETYPE_INCLUDE_DIRS})

generate_export_header(OgreOverlay
EXPORT_MACRO_NAME _OgreOverlayExport
Expand Down
11 changes: 4 additions & 7 deletions Components/Paging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
# Add needed definitions
add_definitions(-DOGRE_PAGING_EXPORTS ${OGRE_VISIBILITY_FLAGS})

# include headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# setup target
add_library(OgrePaging ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgrePaging PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgrePaging OgreMain)
if (OGRE_CONFIG_THREADS)
target_link_libraries(OgrePaging ${OGRE_THREAD_LIBRARIES})
endif ()
target_link_libraries(OgrePaging PUBLIC OgreMain)
target_include_directories(OgrePaging PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/Paging>)

# install
ogre_config_framework(OgrePaging)
Expand Down
8 changes: 4 additions & 4 deletions Components/Property/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ set (SOURCE_FILES
src/OgreProperty.cpp
)

# include headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
# workaround Wundef with boost
Expand All @@ -37,7 +34,10 @@ endif()
# setup target
add_library(OgreProperty ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreProperty PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreProperty OgreMain)
target_link_libraries(OgreProperty PUBLIC OgreMain)
target_include_directories(OgreProperty PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/Property>)

generate_export_header(OgreProperty
EXPORT_MACRO_NAME _OgrePropertyExport
Expand Down
Loading

0 comments on commit 9c2055e

Please sign in to comment.