CMake has a built-in property, `POSITION_INDEPENDENT_CODE`, that determines
if code will be built with `-fPIC`. This property is `True` by default for
`SHARED` and `MODULE` library targets and `False` otherwise. Previously,
we were always passing the `-fPIC` flag manually. With this change, we set
the appropriate CMake variable that will enable the property for all
compile jobs.
Furthermore, with CMake policy CMP0083 set to "new" (which happens by
default when the `cmake_minimum_required` version is >=3.14), CMake has
built-in support for passing the `-fpie` flag when building executables. It
uses the same property, `POSITION_INDEPENDENT_CODE`, so setting this
property (and enabling it with the CMake `CheckPIESupported` module) allows
us to use CMake's built-in support for these flags.
Signed-off-by: Chris Burel <burelc@amazon.com>
- Add the following compilation flags for clang
-fpie
-fstack-protector-all
-fstack-check (non-release)
- Add the following compilation flags for gcc
-fpie
-fstack-protector-all
- Fix -Wunused-result errors from above compilation flag updates
- Add _FORTIFY_SOURCE=2 to GCC DEFINES
Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
Updates and fixes to support GCC for Linux
Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* Ninja compile and link pool CMake settings
Signed-off-by: L4stR1t3s <69721170+L4stR1t3s@users.noreply.github.com>
* Added CMake cached variables for Ninja compile/link pool settings
Signed-off-by: L4stR1t3s <69721170+L4stR1t3s@users.noreply.github.com>
* Final update copyright headers to reference license files at the repo root
Signed-off-by: spham <spham@amazon.com>
* Fix copyright validator unit tests to support the stale O3DE header scenario
Signed-off-by: spham <spham@amazon.com>