1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

CMake transitive compile dependency

Moving to more target focusing code that provides better transitive scope
This commit is contained in:
Michał Kalinowski 2019-01-19 00:57:54 +01:00 committed by ArseniyShestakov
parent b00e935e4d
commit a0d1808b62
5 changed files with 36 additions and 19 deletions

View File

@ -1,7 +1,3 @@
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
set(client_SRCS
StdInc.cpp
../CCallback.cpp
@ -181,6 +177,16 @@ target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES}
${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2_MIXER_LIBRARY} ${SDL2_TTF_LIBRARY}
${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES} ${FFMPEG_EXTRA_LINKING_OPTIONS} ${SYSTEM_LIBS}
)
target_include_directories(vcmi
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${SDL2_INCLUDE_DIR}
PRIVATE ${SDL2_TTF_INCLUDE_DIR}
PRIVATE ${SDL2_MIXER_INCLUDE_DIR}
PRIVATE ${SDL2_IMAGE_INCLUDE_DIR}
PRIVATE ${FFMPEG_INCLUDE_DIRS}
)
vcmi_set_output_dir(vcmiclient "")
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})

View File

@ -1,8 +1,3 @@
# Detailed information about CMake compatibility available on Qt website
# https://doc.qt.io/qt-5/cmake-manual.html
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${ZLIB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
set(launcher_modmanager_SRCS
modManager/cdownloadmanager_moc.cpp
modManager/cmodlist.cpp
@ -104,7 +99,11 @@ if(APPLE)
endif()
target_link_libraries(vcmilauncher vcmi Qt5::Widgets Qt5::Network)
target_include_directories(vcmilauncher
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${Qt5Widgets_INCLUDE_DIRS}
PRIVATE ${Qt5Network_INCLUDE_DIRS}
)
vcmi_set_output_dir(vcmilauncher "")
# temporary(?) disabled - generation of PCH takes too much time since cotire is trying to collect all Qt headers

View File

@ -1,6 +1,3 @@
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/lib)
include_directories(${Boost_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
set(lib_SRCS
StdInc.cpp
${CMAKE_BINARY_DIR}/Version.cpp
@ -358,6 +355,15 @@ add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
set_target_properties(vcmi PROPERTIES COMPILE_DEFINITIONS "VCMI_DLL=1")
target_link_libraries(vcmi ${MINIZIP_LIBRARIES} ${Boost_LIBRARIES} ${SDL2_LIBRARY} ${ZLIB_LIBRARIES} ${SYSTEM_LIBS})
target_include_directories(vcmi
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_HOME_DIRECTORY}
PUBLIC ${CMAKE_HOME_DIRECTORY}/include
PUBLIC ${Boost_INCLUDE_DIRS}
PUBLIC ${ZLIB_INCLUDE_DIR}
PRIVATE ${SDL2_INCLUDE_DIR}
)
if(WIN32)
set_target_properties(vcmi
PROPERTIES

View File

@ -1,6 +1,3 @@
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
set(server_SRCS
StdInc.cpp
@ -29,6 +26,10 @@ add_executable(vcmiserver ${server_SRCS} ${server_HEADERS})
target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${SYSTEM_LIBS})
target_include_directories(vcmiserver
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
if(WIN32)
set_target_properties(vcmiserver
PROPERTIES

View File

@ -9,9 +9,6 @@ if(EXISTS ${googleTest_Dir})
else()
message(FATAL_ERROR "No googletest src dir found!")
endif()
include_directories(${GTestSrc} ${GTestSrc}/include ${GMockSrc} ${GMockSrc}/include)
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/test)
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
set(test_SRCS
StdInc.cpp
@ -114,6 +111,14 @@ add_subdirectory_with_folder("3rdparty" googletest EXCLUDE_FROM_ALL)
add_executable(vcmitest ${test_SRCS} ${test_HEADERS} ${mock_HEADERS} ${GTestSrc}/src/gtest-all.cc ${GMockSrc}/src/gmock-all.cc)
target_link_libraries(vcmitest vcmi ${RT_LIB} ${DL_LIB})
target_include_directories(
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${GTestSrc}
PRIVATE ${GTestSrc}/include
PRIVATE ${GMockSrc}
PRIVATE ${GMockSrc}/include
)
if(FALSE AND NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
# Running tests one by one using ctest not recommended due to vcmi having
# slow global initialization.