* Custom cache directory name
Enable setting a custom directory name for cached packages.
Required if e.g. patch_command uses external variables or
just to set a human readable name.
* fixup! review comment CUSTOM_CACHE_DIR -> CUSTOM_CACHE_KEY
* run cmake-format
---------
Co-authored-by: Olsson Gerhard <gerhard.olsson@volvo.com>
Co-authored-by: Lars Melchior <lars.melchior@gmail.com>
* Add file locking to support parallel runs.
* Fixed formatting.
* Prevent double locking file.
* Fix SegFault from test 2.
* Remove unnecessary debugging messages.
* Lock the package directory rather than the cache directory.
Only synchronize if CPM_SOURCE_CACHE is defined.
* Lock the version specific cache entry rather than the package specific entry.
* Remove unnecessary arguments in conditional statements.
* Change back to locking entire cache directory.
* Only check CPM_HAS_CACHE_LOCK.
* Lock on a per-package basis rather than the entire cache.
* Clean up the locked file.
* Unlock then remove to fix Windows.
* Specify use of cmake.lock as the lock file.
* - Changed CPM_HAS_CACHE_LOCK to ${CPM_ARGS_NAME}_CPM_HAS_CACHE_LOCK.
- Removed redundant variable initialization.
* Add unit test.
* Actually test if resulting git cache is clean in unit test.
* - Added comments
- Fixed formatting
- Removed unnecessary imports
* convert parallelism test to integration test
* remove comment
* - Removed now unnecessary variable.
- Only delete file instead of unlocking it then deleting it.
* Forgot to change variable name.
* Add similar changes to the missed section.
* Fixed formatting.
* Unlock the file, but do not delete it.
* Only unlock the file if it exists.
* Changed cache.cmake test to ignore non-directory entries.
* Integration test lib make_project:
* keyword args
* 'name' arg to allow multiple projects from the same test
* - Moved checks to function.
- Fixed small grammatical errors.
* - Fix formatting
* Switch to snake case.
---------
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
Co-authored-by: Lars Melchior <lars.melchior@gmail.com>
Co-authored-by: Borislav Stanimirov <b.stanimirov@abv.bg>
* Check that the cache working directory is clean
* cpm_check_working_dir_is_clean for non git repo will not terminate cmake
* sileneced check for git repo, in case of error
* style(CPM.cmake): fixed indentation for ERROR_QUIET
* refactor(CPM.cmake): added logic to handle a cache folder inside a (not correlated) git repo
this is accomplished by checking if we are in the directory where .git lives
* style(CPM.cmake): stray tab to spaces
* test(dirty-cache-check): added unit test to check cpm_check_working_dir_is_clean
the test creates a file in a folder and then uses git to create a repo in that folder, to check various conditions
* Update test/unit/dirty-cache-check.cmake
added user.name and user.email to comply with test machine where git is not completely configured
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* feat(cpm_check_working_dir_is_clean): now it takes a git tag (works with hashes too) to check for uncommitted and commited changes
* refactor(cpm_check_working_dir_is_clean): early return for the most common case of uncommited changes in a repo
* refactor(cpm_check_git_working_dir_is_clean): removed edgecase detection (a non-git folder in an unrelated git repo)
now the contract is that com_check_git_working_dir_is_clean is given the base folder of a git repo
Co-authored-by: Andrew Gribble <ag131012@renishaw.com>
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
Add fetchcontent_dependency unit test:
* This test should highlight the fact that cpm_add_subdirectory is always called, even when
cpm_fetch_package isn't populating the dependency
* NO_CACHE YES highlight a bug introduced in 32b063eba5 where
cpm_fetch_package was checking undefined ${lower_case_name}_POPULATED variable
https://github.com/cpm-cmake/CPM.cmake/issues/287
* Added support for bitbucket repositories:
* added variable BITBUCKET_REPOSITORY
* added short syntax in form "bb:user/repo"
* added description of that to readme.md
* Added test for bitbucket short syntax
* Used elseif syntax in handling of git services (github, gitlab, bitbucket).
* Added HEMRND/TestingFramework example located on bitbucket.org
* Reformatted CMakeLists.txt in TestingFramework example
* Bumped version of TestingFramework. It supports older version of c++ standard.
Co-authored-by: Paweł Gorgoń <pgorgon@hem-e.com>
* Fix#222
* Fix#222
* move policy change and local options to cpm_add_subdirectory
* change default policy as well
see https://gitlab.kitware.com/cmake/cmake/-/issues/20312
* add test
* update check to not use the NOT operator
(interestingly it works as expected locally)
* simplify test by not using options
* check options in tests
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Function to extract name and version from url. Some tests
* Rewrite. Previous version was not safe enough. More tests
* Allow underscore as a name-version separator (<name>_<ver>)
* CPMAddPackage can infer name and version from url
* Allow URL parse from single arg and uncomment tests
* Info about shorthand syntax in README
* Fix style
* Fixed typo
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Explicit hash algorithm in shorthand URL example.
Also added tests which include a hash algorithm provided
We can't document a default until it's confirmed here: https://gitlab.kitware.com/cmake/cmake/-/issues/21859
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Added quotes in equality checks so lists can be compared
* Function to parse argument of CPMAddPackage in case a single one was provided
* Error on URL type in CPMAddPackage single-arg
* Fixed format
* Support single argument syntax of CPMAddPackage
* Documenting and showcasing the new shorthand syntax of CPMAddPackage
* Auto EXCLUDE_FROM_ALL for the shorthand syntax
* Fixed accidental paste of TOLOWER
* Document why some test cases are commented out
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Update README.md
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Removed GitHub as the default package shorthand provider
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Added assert_not_defined check
* Function to get package name form git uri and tests
* Autofix format
* If name is not provided, try to infer it from the git repo
* Unset result of cpm_package_name_from_git_uri if there is no match
- Also reordered tests to ensure that the result is actually unset when needed
* Removed trailing spaces in README
* Updated the main example with the new minimal syntax
* Well... autofix format again
* Update error message for missing name to reflect the possible auto-infer step
* Autofix format... yet again :)
* add dependencies using EXCLUDE_FROM_ALL flag
* respect DOWNLOAD_ONLY flag
* set EXCLUDE_FROM_ALL as an optional flag
* use one value arg for consistency
* fix argument passing
* add unit test
* update cmake-format
* add prettify macro
* apply the prettier and change the name of the output arg
* add parameter inside macro
* resolve path if its cmake_sourc_dir
* add missing uparsed argument
* add early unit test for prettifier
* retab prettify_cpm_add_package
* rename prettify_cpm_add_package cpm_prettyfy_package_arguments
* convert macro to function and fix unit test
* fix typo in the name of the parse argument in prettyfy function
* change the unit test to test only the function
* add test for the commented part
* remove dead code
* fix typo
* run cmake-format on CPM.cmake
* reformated unit test prettify
* flip the logic to add space on new argument unparsed to avoir space at the end
* remove debug message
* apply most suggestion from pr 162, disable formating only for small part in unit test
* add unit test to cover defauld source dir added inside lock
* run format tool on unit test
* remove dead code
* change the prettifier from 4 space to 2
* run format on unit test
* apply clang-format and cmake-format and add style check workflow
* add declare package definition
* add additional public methods and rename internals
* change development verison tag to 1.0.0
* rename internal method
* rename public method
* rename test var
* update copyright and fix comment
* typo
* run fix-format
* fix test function names
* Use shallow clone for git repositories by default (#129)
* use shallow clone for git repositories by default
* remove trailing spaces
* Enable shallow clone for actual tags
* Support short commit hash
* Enable shallow only when downloading dependencies into cache
* Always honor user specified GIT_SHALLOW opiton
* create FindXXX.cmake modules for added CPM packages
* don't use list(PREPEND) as it unsupported on older CMake versions
* use CMAKE_BINARY_DIR
* ensure CPM.cmake is initialized only once
* import CPM.cmake in modules
* use semicolon as empty command and add test
* remove platform specific test coverage
* only run actions for pushes and prs into master (avoid duplication)
* remove cache test as it's already part of the test suite
* update version
* test cache reuse