Dont include test executable when called from Conan
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2019-12-27 13:50:12 +01:00
parent 653e54a728
commit fa81bd59d6
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 13 additions and 7 deletions

View File

@ -24,9 +24,11 @@ add_library(CreatureLibLibrary SHARED ${LIBRARY_SRC_FILES})
file(GLOB_RECURSE BATTLING_SRC_FILES "src/Battling/*.cpp" "src/Battling/*.hpp")
add_library(CreatureLibBattling SHARED ${BATTLING_SRC_FILES})
# Create Test executable
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(CreatureLibTests ${TEST_FILES} extern/catch.hpp)
if (NOT DEFINED CONAN_EXPORTED)
# Create Test executable
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(CreatureLibTests ${TEST_FILES} extern/catch.hpp)
endif ()
# Link the core library to the individual other libraries
target_link_libraries(CreatureLibLibrary CreatureLibCore)
@ -35,8 +37,10 @@ target_link_libraries(CreatureLibBattling CreatureLibCore)
# Link the library data to the Battling library
target_link_libraries(CreatureLibBattling CreatureLibLibrary)
target_link_libraries(CreatureLibTests CreatureLibLibrary)
target_link_libraries(CreatureLibTests CreatureLibBattling)
if (NOT DEFINED CONAN_EXPORTED)
target_link_libraries(CreatureLibTests CreatureLibLibrary)
target_link_libraries(CreatureLibTests CreatureLibBattling)
endif ()
if (WINDOWS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
@ -47,8 +51,10 @@ if (WINDOWS)
target_link_libraries(CreatureLibTests -static -static-libgcc -static-libstdc++)
endif (WINDOWS)
# Add a definition for the test library
target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD)
if (NOT DEFINED CONAN_EXPORTED)
# Add a definition for the test library
target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD)
endif ()
if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)