cmake_minimum_required(VERSION 2.8.12) project(pkmnLib NONE) include(ExternalProject) ExternalProject_Add(CreatureLibProj GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/CreatureLib GIT_TAG master PREFIX "${CMAKE_CURRENT_BINARY_DIR}/CreatureLib" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" TEST_COMMAND "" CMAKE_ARGS "-DSHARED=${SHARED} -DWINDOWS=${WINDOWS} -DSTATICC=${STATICC}" ) function(include_creaturelib) configure_file(CMakeLists.txt.creaturelib.in CreatureLib/download/CMakeLists.txt) execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/download) if (result) message(FATAL_ERROR "CMake step for arbutils failed: ${result}") endif () execute_process(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/download) if (result) message(FATAL_ERROR "Build step for arbutils failed: ${result}") endif () add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/src/CreatureLibProj ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/bin EXCLUDE_FROM_ALL) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/include) execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/src/CreatureLibProj/src ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/include/CreatureLib) include_directories(${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/bin/Arbutils/include ${CMAKE_CURRENT_BINARY_DIR}/CreatureLib/include) endfunction()