Created
November 29, 2019 21:17
-
-
Save samee/a5f8f1f5f133192dc8ef3f933f3f35da to your computer and use it in GitHub Desktop.
Using ExternalProject with cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.10) | |
include(ExternalProject) | |
ExternalProject_Add(fmtlib | |
GIT_REPOSITORY https://github.com/fmtlib/fmt.git | |
EXCLUDE_FROM_ALL TRUE | |
BUILD_COMMAND $(MAKE) fmt | |
STEP_TARGETS build) | |
set(fmtlib_BINARY_DIR "${CMAKE_BINARY_DIR}/fmtlib-prefix/src/fmtlib-build") | |
set(fmtlib_SOURCE_DIR "${CMAKE_BINARY_DIR}/fmtlib-prefix/src/fmtlib/include") | |
add_executable(fmttest fmttest.cpp) | |
add_dependencies(fmttest fmtlib-build) | |
target_link_libraries(fmttest ${fmtlib_BINARY_DIR}/libfmt.a) | |
target_include_directories(fmttest PUBLIC ${fmtlib_SOURCE_DIR}) | |
# Tested with fmttest.cpp: | |
# | |
# #include "fmt/format.h" | |
# int main() { fmt::print("Hello {}!\n", "world"); } | |
# | |
# The trouble is, there is no easy way to make network-update optional. | |
# It kicks and screams if there is no network connection. There has to be a way | |
# To make updates optional. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe have a look at how this is done: http://google.github.io/googletest/quickstart-cmake.html