pybind11/tools
Jason Rhinelander 1bee6e7df8 Overhaul LTO flag detection
Clang on linux currently fails to run cmake:

    $ CC=clang CXX=clang++ cmake ..
    ...
    -- Configuring done
    CMake Error at tools/pybind11Tools.cmake:135 (target_compile_options):
      Error evaluating generator expression:

        $<:-flto>

      Expression did not evaluate to a known generator expression
    Call Stack (most recent call first):
      tests/CMakeLists.txt:68 (pybind11_add_module)

But investigating this led to various other -flto detection problems;
this commit thus overhauls LTO flag detection:

- -flto needs to be passed to the linker as well
- Also compile with -fno-fat-lto-objects under GCC
- Pass the equivalent flags to MSVC
- Enable LTO flags for via generator expressions (for non-debug builds
  only), so that multi-config builds (like on Windows) still work
  properly.  This seems reasonable, however, even on single-config
  builds (and simplifies the cmake code a bit).
- clang's lto linker plugins don't accept '-Os', so replace it with
  '-O3' when doing a MINSIZEREL build
- Enable trying ThinLTO by default for test suite (only affects clang)
- Match Clang$ rather than ^Clang$ because, for cmake with 3.0+
  policies in effect, the compiler ID will be AppleClang on macOS.
2017-02-14 10:59:59 +01:00
..
clang@254c7a91e3 cindex.py updated 2016-07-01 12:21:53 +02:00
check-style.sh check-style.sh: check for accidentally committed CRLF line endings 2016-12-13 00:24:08 +01:00
FindEigen3.cmake transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
FindPythonLibsNew.cmake Improve FindPythonLibsNew detection of python library directory (#523) 2016-11-22 22:01:03 +01:00
libsize.py Always use return_value_policy::move for rvalues (#510) 2016-11-20 05:31:02 +01:00
mkdoc.py mkdoc.py: improved formatting of code segments and enums 2016-05-20 16:37:13 +02:00
pybind11Config.cmake.in fix one lingering ::pybind11 --> ::module target name (#603) 2017-01-13 11:10:22 +01:00
pybind11Tools.cmake Overhaul LTO flag detection 2017-02-14 10:59:59 +01:00