cmake_minimum_required(VERSION 2.8.12) project(pkmnLib NONE) include(ExternalProject) ExternalProject_Add(AngelscriptProj GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/Angelscript.git GIT_TAG master PREFIX "${CMAKE_CURRENT_BINARY_DIR}/Angelscript" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" TEST_COMMAND "" ) function(include_angelscript) configure_file(CMakeLists.txt.angelscript.in Angelscript/download/CMakeLists.txt) execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Angelscript/download) if (result) message(FATAL_ERROR "CMake step for angelscript failed: ${result}") endif () execute_process(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Angelscript/download) if (result) message(FATAL_ERROR "Build step for angelscript failed: ${result}") endif () SET(BUILD_SHARED_LIBS ${SHARED}) SET(LINK_STD_STATICALLY ${STATICC}) SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON) if (WINDOWS) SET(MSVC 1) endif() add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/Angelscript/src/AngelscriptProj/angelscript/projects/cmake ${CMAKE_CURRENT_BINARY_DIR}/Angelscript/bin EXCLUDE_FROM_ALL) if (WINDOWS) set_target_properties(angelscript PROPERTIES SUFFIX ".dll") endif (WINDOWS) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Angelscript/include) include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/Angelscript/src/AngelscriptProj/angelscript/include) endfunction()