`GIT_REPOSITORY` will cause cmake to rebuild if local dependency
changes, which isn't the case for `URL`.
Also document how to test a different commits of a dependency.
This will reduce friction as developers no longer need to provide a hash
when testing out different commits.
To skip the hash check, set `DEPS_IGNORE_SHA` to `TRUE` in
`cmake.deps/CMakeLists.txt`.
This will reduce required boilerplate, but more importantly it will
automatically unset variables ending on URL. This will help people
needing to avoid to unset the URL variable each time a new dependency is
added.
It is possible that this may remove a non-download variable ending on
"URL" in the future, however, the risk of this is likely much lower than
the risk of someone forgetting to unset the variable.
Previously, all targets were connected in one main target called
third-party in order to remove any potentially conflicting shared
library. We can make each dependency target independent of each other by
only removing shared libraries from luajit and msgpack in their own
targets, as only these has unwanted shared libraries.
There are a number of cmake variables and cache variables that need to
be passed to all dependencies. This is not only cumbersome, but also
fragile as it's easy to miss adding or removing a flag from a dependency
by accident. Introducing a global variable that controls all builds
makes it much easier to handle our dependencies.
Also fixes the currently broken release workflow as we need to pass the
CMAKE_OSX_ARCHITECTURES variable to all dependencies built with cmake.
The default cmake installation process for dependencies that use cmake
on all platforms is in general more robust and less verbose, so we rely
on that if possible.
59d5f692f removed cmake.deps/cmake/DownloadAndExtractFile.cmake and
support for USE_EXISTING_SRC_DIR. The Ubuntu nightly PPA still relies
on USE_EXISTING_SRC_DIR functionality since it can't access the network
during the build.
Supplying an empty value for ExternalProject_Add()'s URL value appears
to provide the needed mechanism to avoid re-downloading when the sources
are already present. This is undocumented behavior, though, so it may
break in the future.
Now, if USE_EXISTING_SRC_DIR is set, the ExternalProject's URL variable
is unset, preventing the download and erroring out if the source doesn't
actually exist.
DownloadAndExtractFile.cmake was initially introduced as a workaround to
avoid the massive amounts of logs generated by the download progress.
This is not a problem anymore as ExternalProject_Add has had the
DOWNLOAD_NO_PROGRESS option since cmake version 3.1.
Change the default build type to always be Debug, and allow only four
predefined build types: Debug, Release, RelWithDebInfo and MinRelSize.
Furthermore, flags meant for single-configuration generator (make,
ninja) will not be used for multi-configuration generators (visual
studio, Xcode), and flags meant for multi-configuration generators will
not be used for single-configuration generators.
This will allow Debug builds to be built with MSVC which requires that
all dependencies are also built with the Debug build type to avoid
runtime library mismatch.
The correct way to specify build type (for example Release) for
single-configuration generators (Make and Ninja) is to run
cmake -B build -D CMAKE_BUILD_TYPE=Release
cmake --build build
while for multi-configuration generators (Visual Studio, Xcode and Ninja
Multi-Config) is to run
cmake -B build
cmake --build build --config Release
Passing CMAKE_BUILD_TYPE for multi-config generators will now not only
not be used, but also generate a warning for the user.
Co-authored-by: dundargoc <gocundar@gmail.com>
Problem:
Dirs "config", "packaging", and "third-party" are all closely related
but this is not obvious from the layout. This adds friction for new
contributors.
Solution:
- rename config/ to cmake.config/
- rename test/config/ to test/cmakeconfig/ because it is used in Lua
tests: require('test.cmakeconfig.paths').
- rename packaging/ to cmake.packaging/
- rename third-party/ to cmake.deps/ (parallel with .deps/)