diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-04-03 19:51:22 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-06-01 14:06:20 +0200 |
commit | bc02bcd920eac0ca5a930a8272737db10fc4be1f (patch) | |
tree | 7bf9f6cc739d4b2127adb2704cdd3a8b9c3bdbe0 /cmake/IdeSplitSources.cmake | |
parent | 172a28860b3e4743d7ccd4409f6f51bc7c00fdfd (diff) | |
download | libgit2-bc02bcd920eac0ca5a930a8272737db10fc4be1f.tar.gz |
cmake: move modules into the "cmake/" top level dir
Our custom CMake module currently live in "cmake/Modules". As the
"cmake/" directory doesn't contain anything except the "Modules"
directory, it doesn't really make sense to have the additional
intermediate directory. So let's instead move the modules one level up
into the "cmake/" top level directory.
Diffstat (limited to 'cmake/IdeSplitSources.cmake')
-rw-r--r-- | cmake/IdeSplitSources.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/IdeSplitSources.cmake b/cmake/IdeSplitSources.cmake new file mode 100644 index 000000000..e2e09b4ce --- /dev/null +++ b/cmake/IdeSplitSources.cmake @@ -0,0 +1,22 @@ +# This function splits the sources files up into their appropriate +# subdirectories. This is especially useful for IDEs like Xcode and +# Visual Studio, so that you can navigate into the libgit2_clar project, +# and see the folders within the tests folder (instead of just seeing all +# source and tests in a single folder.) +FUNCTION(IDE_SPLIT_SOURCES target) + IF(MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode) + GET_TARGET_PROPERTY(sources ${target} SOURCES) + FOREACH(source ${sources}) + IF(source MATCHES ".*/") + STRING(REPLACE ${libgit2_SOURCE_DIR}/ "" rel ${source}) + IF(rel) + STRING(REGEX REPLACE "/([^/]*)$" "" rel ${rel}) + IF(rel) + STRING(REPLACE "/" "\\\\" rel ${rel}) + SOURCE_GROUP(${rel} FILES ${source}) + ENDIF() + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() +ENDFUNCTION() |