From bce39a944d83bed6bf0fad82db7544c6a838b77e Mon Sep 17 00:00:00 2001 From: Mohammed Alyousef Date: Tue, 15 Sep 2020 19:25:03 +0300 Subject: [PATCH] use fetch-content instead of submodules --- .gitmodules | 3 --- CMakeLists.txt | 14 +++++++++++++- README.md | 9 ++++++--- cmake.toml | 6 +++++- vendor | 1 - 5 files changed, 24 insertions(+), 9 deletions(-) delete mode 100644 .gitmodules delete mode 160000 vendor diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 62b2b62..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "vendor"] - path = vendor - url = https://github.com/ToruNiina/toml11.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 60a50ae..d481646 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) project(cmkr VERSION 0.1.0) +include(FetchContent) + +FetchContent_Declare( + toml11 + GIT_REPOSITORY https://github.com/ToruNiina/toml11 + ) + +FetchContent_MakeAvailable(toml11) + set(CMKRLIB_SOURCES "src/cmake.cpp" @@ -19,7 +28,10 @@ add_library(cmkrlib STATIC ${CMKRLIB_SOURCES}) target_include_directories(cmkrlib PUBLIC "include" - "vendor" + ) + +target_link_libraries(cmkrlib PUBLIC + toml11::toml11 ) target_compile_features(cmkrlib PUBLIC diff --git a/README.md b/README.md index 598356b..6f1d7f2 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,7 @@ cmkr requires a C++17 compiler, cmake >= 3.14 and git. It depends on toml11 by T ``` git clone https://github.com/moalyousef/cmkr cd cmkr -git submodule update --init --recursive -cmake -S. -Bbin +cmake -Bbin cmake --build bin ``` @@ -37,12 +36,16 @@ minimum = "3.14" name = "cmkr" version = "0.1.0" +[fetch-content] +toml11 = { GIT_REPOSITORY = "https://github.com/ToruNiina/toml11" } + [[bin]] name = "cmkrlib" type = "static" sources = ["src/cmake.cpp", "src/gen.cpp", "src/help.cpp", "src/build.cpp", "src/error.cpp"] -include-dirs = ["include", "vendor"] +include-dirs = ["include"] features = ["cxx_std_17"] +link-libs = ["toml11::toml11"] [[bin]] name = "cmkr" diff --git a/cmake.toml b/cmake.toml index 16f0b85..690f4b2 100644 --- a/cmake.toml +++ b/cmake.toml @@ -5,12 +5,16 @@ minimum = "3.14" name = "cmkr" version = "0.1.0" +[fetch-content] +toml11 = { GIT_REPOSITORY = "https://github.com/ToruNiina/toml11" } + [[bin]] name = "cmkrlib" type = "static" sources = ["src/cmake.cpp", "src/gen.cpp", "src/help.cpp", "src/build.cpp", "src/error.cpp"] -include-dirs = ["include", "vendor"] +include-dirs = ["include"] features = ["cxx_std_17"] +link-libs = ["toml11::toml11"] [[bin]] name = "cmkr" diff --git a/vendor b/vendor deleted file mode 160000 index 9132abc..0000000 --- a/vendor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9132abc5c403bfeaf12a8ff940a9fbdc45220843