Fixes an issue on Windows where when source and build directory are on different drives hard-linking
to files or directory fails as it doesn't work across filesystem boundaries. Note that symlinking is also
not possible because it requires administrator privileges on Windows.
The solution copies the files using the built-in cmake `configure_file(src dest COPYONLY)` command.
As this command only operates on files, if a directory is specified the files will be globbed recursively
and through symlinks.
Signed-off-by: Dominik Gschwind <dominik.gschwind99@gmail.com>
If generation of files is turned off, and a file is missing, when
building in tree with cmake, you can end up with the generated file
being turned into a symlink to itself. This will also break any future
attempt at building with make. Fix this by testing if the file exists
prior to attempting to link it.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
Replace custom LIB_INSTALL_DIR with standard CMAKE_INSTALL_LIBDIR variable.
For backward compatibility, set CMAKE_INSTALL_LIBDIR if LIB_INSTALL_DIR is set.
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
The main CMakeLists.txt is capable to detect if it's being built as
a subproject (i.e. through add_subdirectory()) hence allowing to
disable the package configuration, target export and installation
that generally are not required when mbed TLS is being built as
part of another project.
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
If on windows, turn off GEN_FILES as it does not currently
work (for reasons unknown).
Note: The WIN32 variable is "True on windows systems,
including win64", as one would expect.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
Add a new function that takes a string and removes the
portion following the last '.' character, usually a file
extension. This would transform:
* "a.b.c" into "a.b"
* "name." into "name"
* ".name" into ""
* "no_dot" into "no_dot" (i.e. no change)
CMake's existing file-extension-removal command removes
the largest possible extension which would make "a.b.c"
into "a", which is incorrect for handling tests that have
'.'s within their names.
The desired behaviour was added in CMake 3.14, but we
support CMake >= 3.5.1 (for 3.0) and >= 2.8.12.2 (for 2.x)
at the time of writing.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
When the option is On, CMake will have rules to generate the generated
files using scripts etc. When the option is Off, CMake will assume the
files are available from the source tree; in that mode, it won't require
any extra tools (Perl for example) compared to when we committed the
files to git.
The intention is that users will never need to adjust this option:
- in the development branch (and features branches etc.) the option is
always On (development mode);
- in released tarballs, which include the generated files, we'll switch
the option to Off (release mode) in the same commit that re-adds the
generated files.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Summary:
[CMP0090](https://cmake.org/cmake/help/latest/policy/CMP0090.html) was introduced in CMake version 3.15. The CMake version guard
should be greater or equal to 3.15.
My cmake version is 3.14.5, and run into the following error.
```
cmake --version
cmake version 3.14.5
```
```
CMake Error at CMakeLists.txt:338 (cmake_policy):
Policy "CMP0090" is not known to this version of CMake.
-- Configuring incomplete, errors occurred!
Test Plan:
```
cmake
```
Signed-off-by: lhuang04 <lhuang04@fb.com>
This change enables automatic detection and consumption of Mbed TLS
library targets from within other CMake projects. By generating an
`MbedTLSConfig.cmake` file, consuming projects receive a more complete
view of these targets, allowing them to be used as dependencies which
properly inherit the transitive dependencies of the libraries.
This is fairly fragile, as it seems Mbed TLS's libraries do not appear
to properly model their dependencies on other targets, including
third-party dependencies. It is, however, sufficient for building and
linking the compiled Mbed TLS libraries when there are no third-party
dependencies involved. Further work is needed for more complex
use-cases, but this will likely meet the needs of most projects.
Resolves#298. Probably useful for #2857.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Building the library without entropy sources negates any and all security
provided by the library.
This option was originally requested a relatively long time ago and it
does not provide any tangible benefit for users any more.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
Reduce level of format truncation warnings due to issues with false
positives (an unknown size buffer is always treated as size 1)
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
Add extra printf warning flags into the cmake build, only adding those
that are supported by each version of the compiler
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
Make sure that CMP0012 is set to NEW, without which FindPython3 and
FindPython2 functionality becomes broken with CMake 3.18.2 if searching
by location. CMP0012 being set to OLD is also deprecated as of 3.18.3.
Ensure CMP0011 is set to NEW to avoid warnings and deprecated behaviour
being issued about policy push / pop with CMake 3.18.0 or newer.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
* As described in issue #3801 the upcoming cmake 3.19
will not support cmake 2.6 any more
* This PR updates the mimimum required cmake version
to 2.8.12, which will not give a warning with cmake 3.19
but still compatible with MbedTLS support of RHEL/CentOS 7 LTS
* Adding ChangeLog.d/bugfix_PR3802.txt
Signed-off-by: Peter Toft <peter.toft@dirac.com>
Allows required targets to have prefixes added to them, so that external
projects can avoid target names clashing.
Signed-off-by: Raef Coles <raef.coles@arm.com>
Also adjusted the different makefiles accordingly.
Note: driver lifetime is currently statically defined in the header, but
this will be replaced in the future based on autogeneration of lifetime
values by a script (TBD)
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>