Commit Graph

319 Commits

Author SHA1 Message Date
Kamil Kisiel
65c760a840 Expand absolute path later in get_cpm.cmake (#397)
* 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
2022-09-13 20:54:57 +00:00
Robert Maynard
b5e60e72e8 cpm_find_package Use found package version when possible (#396) 2022-09-13 22:44:24 +02:00
Robert Maynard
10bf25a811 Restore policy changes in CPMAddPackage (#388)
* Restore policy changes in CPMAddPackage

Fixes #387

* Correct style issues found by CI
v0.35.5
2022-08-11 19:12:21 +00:00
Lars Melchior
18b6cbf233 perform policy changes only in top-level CPM.cmake script (#386) 2022-08-09 12:56:46 +02:00
Olivier Le Doeuff
698741ff7c Fix a very confusing typo (#384) 2022-08-04 10:34:33 +03:00
Borislav Stanimirov
1f09de0d9b Document policies being set to NEW when including CPM.cmake (#383) 2022-08-04 08:32:05 +02:00
Robert Maynard
b224ce280d Timestamps for URL downloads match the download time (#372)
* 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>
v0.35.4
2022-08-04 00:22:50 +02:00
Lars Melchior
49af958fb4 Use 3 column layout in showcase (#381) 2022-08-03 10:55:32 +03:00
Evgeny Gorodetskiy
90c763532a Add Methane Kit project to showcase table in ReadMe (#380)
* Add MethaneKit project to the showcase table

* Shorten description, wrap to new line in table
2022-08-01 20:55:03 +02:00
Robert Maynard
4605d32f0e CPM_DIRECTORY always stores absolute non symlink paths (#379)
* 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
v0.35.3
2022-07-31 21:51:27 +02:00
Thomas Mosegaard Pedersen
ede60451a9 CPMAddPackage fails if the SOURCE_DIR directory is deleted. (#370)
* 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
v0.35.2
2022-07-26 07:15:11 +00:00
David Fong
5961f9f9fb bump example range-v3 to 0.12.0 (#366)
* bump range-v3 to 0.12.0

* bump range-v3 to 0.12.0
2022-07-02 12:56:11 +00:00
Anton Filimonov
69e9ff3766 Klogg switched to CPM for dependency management (#363)
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!
2022-06-27 23:39:13 +02:00
Olivier Le Doeuff
3fee69c894 Add readme "Customize repository URL" with git-config (#353) 2022-05-17 08:17:14 +02:00
Lars Melchior
a575ab57b7 Allow overriding FetchContent using CPM (#352)
* Override FetchContent paramers, fixes #281

* add check to verify that dependency is cached

* update test comment

* rename test file and class

* update test indentation
v0.35.1
2022-05-16 21:28:44 +02:00
Lava Block
ca421f0e0c Add liblava to "Built with CPM.cmake" (#346) 2022-04-10 18:59:05 +00:00
Robert Maynard
005f202655 Add per package CPM_DOWNLOAD controls (#336)
* 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
v0.35.0
2022-02-11 19:37:32 +01:00
Lars Bilke
865648e7bd Fixed typos in comments 2022-02-09 11:25:26 +00:00
Borislav Stanimirov
33bdbae902 List of contributors (#340)
* Updated copyright years. Same copyright holders in code and LICENSE

* Contributor list. Order is from contributors gh page
2022-02-07 20:21:43 +01:00
Tobias Hellmann
9d3fad01d4 Fix broken example for nlohmann/json (#338) 2022-01-27 22:59:28 +00:00
Robert Maynard
11c7ec8afa Use CMake 3.14+ documented way to pass the source dir -S. (#337)
The `-H<src_dir>` was never officially documented by CMake
2022-01-27 23:45:35 +01:00
Robert Maynard
4f7af69925 CMake 3.22 allows set/set(CACHE) to behave the same as set(X)/option(x) (#335)
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`.
2022-01-27 23:36:12 +01:00
Borislav Stanimirov
c58e98a0a0 Initial version of integration tests (#330)
* 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.
2022-01-19 00:18:41 +01:00
Lars Melchior
a27c66a3ea Remove badges (#327)
As we now use the unified CI workflow (#326), it seems we unfortunately [can't have separate badges for each OS](https://github.community/t/separate-workflow-badges-when-using-matrix-testing-possible/16708). As the display of the badges was to reference the cross-platform nature of the project, imo it can be replaced by adding a reference in the introduction instead.
2022-01-13 03:44:07 +02:00
Vinpasso
5cb7398a24 [Example] Disable JSON tests being included in ctest (#329)
* 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
2022-01-12 20:29:59 +01:00
Borislav Stanimirov
262f1e0602 Unified GitHub workflow for tests on major operating systems (#326) 2022-01-11 21:16:04 +01:00
Dan Raviv
7cbef3efc8 Fix comment out-of-sync with modified code (#321) 2022-01-06 08:46:54 +02:00
DNKpp
939123d1b4 Fix <package>_SOURCE_DIR and _BINARY_DIR handling when caching is active (#314)
* fix: use CACHE variables instead relying on FetchContents mechanism

* apply cmake-format

Signed-off-by: DNKpp <DNKpp2011@gmail.com>
v0.34.3
2021-12-30 16:20:37 +01:00
Lars Melchior
22078d5e0d add quotes around module arguments (#313) 2021-12-30 15:20:16 +02:00
Pavel Sokolov
96c268827b Pass DOWNLOAD_ONLY flag when CPM_pkg_SOURCE is set. (#308)
https://github.com/cpm-cmake/CPM.cmake/issues/307
v0.34.2
2021-12-15 21:23:18 +01:00
Lars Melchior
dad37fbe4e Change example ordering and add note on boost (#305)
Reorders examples from simple to more complex. Also adds note on using `CPM_SOURCE_CACHE` for boost.
2021-12-12 15:09:50 +01:00
Lars Melchior
fed5f8e8a2 use official boost release (#304) v0.34.1 2021-12-05 16:08:47 +01:00
Lars Melchior
d65613e860 add warning when not using release version of CPM.cmake (#303) 2021-12-05 16:08:02 +01:00
Lars Melchior
718ea71759 Allow passing lists in the options (#302)
* allow list options by passing option parameter as string, not value

* add test

* remove debug message

* run formatter
2021-12-05 16:07:20 +01:00
Lars Melchior
6491382204 Remove travis badge from readme (#289)
Follow up on #283 to remove the now obsolete travis badge.
2021-09-29 13:48:40 +03:00
pgorgon-hem
634800c619 Added directory inside cache to make it shown more friendly in CLion (#268)
* 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>
v0.34.0
2021-09-15 21:39:31 +02:00
Andrea Barbadoro
f552da96bd Detecting when the cache is dirty (#284)
* 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>
v0.33.0
2021-09-15 11:38:49 +02:00
Olivier Le Doeuff
ea6a8eb895 Fix CPMAddPackage when FetchContent_MakeAvailable already added package (#288)
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
v0.32.3
2021-08-29 22:02:18 +02:00
MixusMinimax
a5c22bf6e8 use quotes for CPM_FILE when creating FIND.cmake (#286) 2021-08-29 22:01:50 +02:00
Lars Melchior
c5cb85b2f1 Build examples in CI using GitHub (#283)
* build examples in CI using github

* update cxxopts style
2021-08-29 20:27:10 +02:00
pgorgon-hem
91585e3864 Added support for bitbucket repositories (#256)
* 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>
v0.32.2
2021-06-08 19:15:40 +02:00
Stuart Dootson
9675d46517 Expand relative download directory to prevent unnecessary download (#267)
* Expand relative download directory to prevent unnecessary download

If `CMAKE_SOURCE_CACHE` (and thus `download_directory`) is set to a relative path, the condition `if(EXISTS ${download_directory})` will fail even if the required directory exists. Expanding the variable `download_directory` to an absolute path before the test will rectify this, preventing unnecessary downloads of the sources.

* iFixed up formatting

Co-authored-by: Stuart Dootson <stuart.dootson@rolls-royce.com>
2021-06-08 19:12:20 +02:00
Lars Melchior
7078e8286a Remove branch name references from README (#265)
As noted in #263, setting `GIT_TAG` to a branch name results in unexpected and unreproducible build behaviour, as it does not automatically update when the `HEAD` changes.
2021-06-08 15:55:03 +03:00
Lars Melchior
6a0277f16e Update CMake to 3.20 for integration tests (#264)
This allows us to use more recent projects in the examples
2021-06-08 15:27:31 +03:00
Lars Melchior
4502bf1e04 Forward exclude and subdir options when using local package override (#261)
* forward exclude and subdir options when using local package override.
fixes #260.

* run cmake format

* add SOURCE_SUBDIR parameter to cmake-format
2021-06-08 15:26:39 +03:00
Clare Macrae
dd3ba9792c Fix typo in README - omit -> emit (#258) 2021-06-02 09:36:29 +03:00
Lars Melchior
de5551e42c Update boost-cmake (#252)
* update boost-cmake

* run cmake-format
2021-05-18 16:29:52 +03:00
Paul Taylor
7644c3a40f Respect FETCHCONTENT_BASE_DIR if set by a user (#244)
* Respect `FETCHCONTENT_BASE_DIR` if set by a user

* Use a single `CPM_FETCHCONTENT_BASE_DIR` var
v0.32.1
2021-04-16 17:27:51 +02:00
Lars Melchior
310efb9b17 Update more examples from the readme (#241)
* update examples from the readme

* add explainations to the examples
2021-03-26 18:31:35 +02:00
Lars Melchior
4fad2eac0a remove option consistency check (#240) v0.32.0 2021-03-25 19:24:44 +02:00