Core/Build: Provide an interface target for game

* Increases the build time because dependent projects can build
  without waiting for the game project.

(cherry picked from commit ff8a54ab92)
This commit is contained in:
Naios
2016-04-13 14:35:04 +02:00
parent 6217cb4bf3
commit ea4ac00ac7
3 changed files with 20 additions and 10 deletions

View File

@@ -23,27 +23,36 @@ GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DTRINITY_API_EXPORT_GAME)
add_library(game
${PRIVATE_PCH_SOURCE}
${PRIVATE_SOURCES}
)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
# Provide an interface target for the game project to allow
# dependent projects to build meanwhile.
add_library(game-interface INTERFACE)
target_include_directories(game-interface
INTERFACE
${PUBLIC_INCLUDES})
target_link_libraries(game-interface
INTERFACE
shared
Detour)
add_library(game
${PRIVATE_PCH_SOURCE}
${PRIVATE_SOURCES})
target_include_directories(game
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(game
PUBLIC
shared
Detour
game-interface
PRIVATE
efsw)

View File

@@ -206,7 +206,7 @@ add_library(scripts STATIC
target_link_libraries(scripts
PUBLIC
game)
game-interface)
target_include_directories(scripts
PUBLIC

View File

@@ -48,6 +48,7 @@ set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAG
target_link_libraries(worldserver
PUBLIC
scripts
game
readline)
CollectIncludeDirectories(