diff options
author | Brad King <brad.king@kitware.com> | 2020-03-25 14:34:29 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-03-25 14:34:40 (GMT) |
commit | ea54f8d44199502d6d02369ea0a2de4e9ef8c1ca (patch) | |
tree | 436bb76821ddb2553fb0ddd10f9689243bcf05d4 /Source | |
parent | 952fbd9ee5b40ddda1a9c4e25a2bc164d138a47a (diff) | |
parent | f034b0f66338f37d4f637916cc42b9c4a4f30a32 (diff) | |
download | CMake-ea54f8d44199502d6d02369ea0a2de4e9ef8c1ca.zip CMake-ea54f8d44199502d6d02369ea0a2de4e9ef8c1ca.tar.gz CMake-ea54f8d44199502d6d02369ea0a2de4e9ef8c1ca.tar.bz2 |
Merge topic 'cmake-compilation-no-compiler-extensions'
f034b0f663 CMake compilation: do not use compiler extensions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4477
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 5 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 10 | ||||
-rw-r--r-- | Source/cmStandardLexer.h | 13 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 10 | ||||
-rw-r--r-- | Source/cmTimestamp.cxx | 10 |
6 files changed, 53 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 467abe9..564e647 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1,6 +1,11 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. +# To ensure maximum portability across various compilers and platforms +# deactivate any compiler extensions +set(CMAKE_C_EXTENSIONS FALSE) +set(CMAKE_CXX_EXTENSIONS FALSE) + include(CheckIncludeFile) # Check if we can build support for ELF parsing. if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index c0d879a..b4085d5 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -1,5 +1,10 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ +#if defined(__CYGWIN__) +// For S_IWRITE symbol +# define _DEFAULT_SOURCE +#endif + #include "cmWIXFilesSourceWriter.h" #include "cm_sys_stat.h" diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 92258e2..5790e16 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -1,5 +1,15 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ + +#if !defined(_WIN32) && !defined(__sun) +// POSIX APIs are needed +# define _POSIX_C_SOURCE 200809L +#endif +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +// For isascii +# define _XOPEN_SOURCE 700 +#endif + #include "cmLoadCommandCommand.h" #include <csignal> diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index 13f7622..55d23c1 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -3,6 +3,19 @@ #ifndef cmStandardLexer_h #define cmStandardLexer_h +#if !defined(_WIN32) && !defined(__sun) +/* POSIX APIs are needed */ +# define _POSIX_C_SOURCE 200809L +#endif +#if defined(__sun) && defined(__GNUC__) && !defined(__cplusplus) +/* C sources: for fileno and strdup */ +# define _XOPEN_SOURCE 600 +#endif +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +/* For isascii */ +# define _XOPEN_SOURCE 700 +#endif + #include "cmsys/Configure.h" // IWYU pragma: keep /* Disable some warnings. */ diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d8cd705..81f76ca 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1,5 +1,15 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ + +#if !defined(_WIN32) && !defined(__sun) +// POSIX APIs are needed +# define _POSIX_C_SOURCE 200809L +#endif +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +// For isascii +# define _XOPEN_SOURCE 700 +#endif + #include "cmSystemTools.h" #include <cmext/algorithm> diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 390fd16..13f73dc 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -1,5 +1,15 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ + +#if !defined(_WIN32) && !defined(__sun) +// POSIX APIs are needed +# define _POSIX_C_SOURCE 200809L +#endif +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +// For isascii +# define _XOPEN_SOURCE 700 +#endif + #include "cmTimestamp.h" #include <cstdlib> |