diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-07-08 13:11:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-08 13:11:05 +0200 |
| commit | 08f287dc5d85d73352fb3d84daef63894ad9cf5c (patch) | |
| tree | 3719738dd44aded9b51f3d5e89403fe59514b29f /src | |
| parent | 35468fd4f72d8497b610362a2d479e08d9944277 (diff) | |
| parent | 7ab3ee73706c128fd82cc497c86229ba05e6df2c (diff) | |
| download | PROJ-08f287dc5d85d73352fb3d84daef63894ad9cf5c.tar.gz PROJ-08f287dc5d85d73352fb3d84daef63894ad9cf5c.zip | |
Merge pull request #2294 from dg0yt/mingw
CMake build: Check "target_clones" before use
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib_proj.cmake | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index abc9cc4b..59cb9572 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -303,7 +303,18 @@ source_group("CMake Files" FILES CMakeLists.txt) # Embed PROJ_LIB data files location add_definitions(-DPROJ_LIB="${CMAKE_INSTALL_PREFIX}/${DATADIR}") -add_definitions(-DTARGET_CLONES_FMA_ALLOWED) +# The gcc "target_clones" function attribute relies on an extension +# to the ELF standard. It must not be used on MinGW. +include(CheckCXXSourceCompiles) +set(CMAKE_REQUIRED_QUIET TRUE) +check_cxx_source_compiles([[ + __attribute__((target_clones("fma","default"))) + int clonable() { return 0; } + int main() { return clonable(); } +]] TARGET_CLONES_FMA_ALLOWED) +if(TARGET_CLONES_FMA_ALLOWED) + add_definitions(-DTARGET_CLONES_FMA_ALLOWED) +endif() ################################################# ## targets: libproj and proj_config.h |
