diff --git a/CMakeLists.txt b/CMakeLists.txt index 8682dc5..ac89c5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,15 +12,16 @@ if (WINDOWS) ADD_DEFINITIONS(-D WINDOWS=1) 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}") +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 file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp") add_library(pkmnLib SHARED ${CORE_SRC_FILES}) @@ -31,12 +32,10 @@ if (NOT DEFINED CONAN_EXPORTED) add_executable(pkmnLibTests ${TEST_FILES} extern/catch.hpp) endif () - foreach (_variableName ${CONAN_LIBS}) message(STATUS "Lib: ${_variableName}") endforeach() -#target_link_libraries(pkmnLib ${CONAN_LIBS}) conan_target_link_libraries(pkmnLib) target_link_libraries(pkmnLibTests pkmnLib) @@ -51,3 +50,5 @@ endif (WINDOWS) # Add a definition for the test library target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD) + +