Execute conan install command in CMake when conan files not found.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2019-12-31 12:22:05 +01:00
parent cb4e4ca829
commit be08c4f09d
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 10 additions and 9 deletions

View File

@ -12,15 +12,16 @@ if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1) ADD_DEFINITIONS(-D WINDOWS=1)
endif(WINDOWS) endif(WINDOWS)
if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else ()
message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first")
endif ()
message(STATUS "Using ${CMAKE_CXX_COMPILER}") message(STATUS "Using ${CMAKE_CXX_COMPILER}")
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing)
endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
# Create Core library with files in src/Core # Create Core library with files in src/Core
file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp") file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp")
add_library(pkmnLib SHARED ${CORE_SRC_FILES}) add_library(pkmnLib SHARED ${CORE_SRC_FILES})
@ -31,12 +32,10 @@ if (NOT DEFINED CONAN_EXPORTED)
add_executable(pkmnLibTests ${TEST_FILES} extern/catch.hpp) add_executable(pkmnLibTests ${TEST_FILES} extern/catch.hpp)
endif () endif ()
foreach (_variableName ${CONAN_LIBS}) foreach (_variableName ${CONAN_LIBS})
message(STATUS "Lib: ${_variableName}") message(STATUS "Lib: ${_variableName}")
endforeach() endforeach()
#target_link_libraries(pkmnLib ${CONAN_LIBS})
conan_target_link_libraries(pkmnLib) conan_target_link_libraries(pkmnLib)
target_link_libraries(pkmnLibTests pkmnLib) target_link_libraries(pkmnLibTests pkmnLib)
@ -51,3 +50,5 @@ endif (WINDOWS)
# Add a definition for the test library # Add a definition for the test library
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD) target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)