cmake_minimum_required(VERSION 2.8.12) project(arbutils-download NONE) include(ExternalProject) ExternalProject_Add(arbutils GIT_REPOSITORY https://git.p-epsilon.com/Deukhoofd/Arbutils GIT_TAG master PREFIX "${CMAKE_CURRENT_BINARY_DIR}/Arbutils" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" TEST_COMMAND "" CMAKE_ARGS "-DSHARED=${SHARED} -DWINDOWS=${WINDOWS} -DSTATICC=${STATICC}" ) function(include_arbutils) # Download and unpack googletest at configure time configure_file(CMakeLists.txt.in Arbutils/download/CMakeLists.txt) execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/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}/Arbutils/download) if (result) message(FATAL_ERROR "Build step for arbutils failed: ${result}") endif () # Add googletest directly to our build. This defines # the gtest and gtest_main targets. add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/bin EXCLUDE_FROM_ALL) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include) execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/src ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include/Arbutils) execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/extern ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include/extern) include_directories(${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include) endfunction()