* 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>
* get_cpm: Recover from failed download
If the download fails during the cmake config step
an empty `CPM_<version>.cmake` file is created.
So far the script only checks the files existence,
so there is no second try until the empty file is deleted manually.
This adds a check if the file is empty
and resumes the download on next config if it is.
* More descriptive function name
* Small helper function for logging :
This PR add an helper function only when `message(STATUS ...)` as the other are `backtracing` and adding the helper function add on stack.
It should fix#328#342 with a few line of code.
* Formatting
* Instead of spdlog's bundled fmt re-use it from CPM.cmake
* Add comment about re-using fmt for spdlog
* Update examples/spdlog/CMakeLists.txt
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* run cmake-format
* disable cmake-format around code block
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Expand absolute path later in get_cpm.cmake
Supports expanding tildes in the environment.
* Apply cmake-format to get_cpm.cmake
* Use .cmake-format file
* Timestamps for URL downloads match the download time
By enabling CMake policy 135 we ensure that extracted files
timestamp match that of the download time, instead of when the
archive is created. This makes sure that if the URL changes to
an older version we still rebuild everything as the timestamp
stays newer.
* Introduce CPM_SET_RECOMMENDED_CMAKE_POLICIES
Enabling CPM_SET_RECOMMENDED_CMAKE_POLICIES will establish defaults
for all CMake policies so that both CPM and added projects
operate inline with CPM recommended best practices.
* Fix style issues found by ci
* Update README.md
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Update cmake/CPM.cmake
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* Set policies when CPM.cmake is included
* CPM_SET_RECOMMENDED_CMAKE_POLICIES default is ON
* Correct failing CI tests
* CPM.cmake always sets policies to on
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
* CPM_DIRECTORY always stores absolute non symlink paths
When CPM is brought into a project via downloading it will be placed
in the build directory. When the build directory is a symlink the
CPM_DIRECTORY value will hold the symlink value. This means that
trying to run CMake via the real build directory will cause CPM
to fail since it considers the current CMAKE_CURRENT_LIST_DIR
to be different and will early exit.
This resolves the issue be always getting CMake to resolve symlinks
before comparing paths for CPM_DIRECTORY.
* Refactor logic based on PR review
* Fixed: Deleted SOURCE_DIR directory would abort just after git stash save --quiet;--include-untracked
* Fixed: Review comments
* Added: Integration test for deleted SOURCE_DIR with FetchContent
* Fixed: Review comments
* Fixed: Review comments
Klogg used to vendor all external dependencies, and now we switched to CPM, and this makes using local dependencies and packaging much easier. Thanks for all you effort!
* Override FetchContent paramers, fixes#281
* add check to verify that dependency is cached
* update test comment
* rename test file and class
* update test indentation
* Add per project CPM_DOWNLOAD controls
Introduces support for `CPM_<PACKAGE>_DOWNLOAD` variable ( and env )
which allows finer grained control.
* Address PR feedback on API names
By enabling CMP0126 we tell CMake that when constructing a CACHE variable
with the same name as a local variable to not unset the local variable.
By enabling CMPO126 it makes sure that CPM behavior around `OPTION` is
consistent if the option is created with `set(CACHE)` or with `option`.
* Initial commit for integration tests. Experimental. Playing with potential syntax
* Some experimental code to setup tests
* Piecewise building of CMakeLists
* First check
* Alternative approach. Using ruby's test/unit
* Parse CMakeCache. Separate lib
* First integration test
* Latest Format.cmake. Passing style
* Allow user-provided integration test dir. Allow reuse
* Separate class with utils for cache (no longer pure Hash)
* Allow running of tests from any dir
* Add integration tests to CI
* Use an in-source integration test directory
* Allow relative integration test dir from env
* Custom assertion for a success of CommandResult
* Windows-latest-latest
* Enrich CMakeCache class with more CPM data
* Added test for CPM-specific CMakeCache values
* Style
* Style
* test_update_single_package
* WiP for source cache test
* Small source_cache test
* Style
* Moved env clean to cleanup to make setup methods simpler (not require super)
* WiP for integration test documentation
* WiP for integration test documentation
* Project file creation tweaks
* Split docs into multiple files. Complete tutorial. Reference.
* Tips
* Typo
* Setup Ruby inistead of requiring windows-2022
* Revert "Setup Ruby inistead of requiring windows-2022"
This reverts commit 8aa2732145.
* Disable JSON tests being included in ctest
If `CPMAddPackage` includes json without setting JSON_BuildTests off first then the target's ctest will include lots of json's tests.
* Bump example JSON version to avoid JSON tests
* Added directory inside cache to make it shown more friendly in CLion
* Changed hash generation to omit collision with old cache scheme. Removed moving old directory for compatibility reason.
* Added CPM_USE_NAMED_CACHE_DIRECTORIES option
* Fixed formatting
* Added description of CPM_USE_NAMED_CACHE_DIRECTORIES into README.md
Co-authored-by: Paweł Gorgoń <pgorgon@hem-e.com>
* 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