Commit Graph

1322 Commits

Author SHA1 Message Date
Letu Ren
988b9928e4 Linux: Avoid finding libraries using lib64 on ArchLinux
ArchLinux uses `/lib` for 64-bit libraries and there is no `/lib64`.
However, unlike Debian, 32-bit libraries are in `/lib32`.
2022-10-30 08:52:59 -04:00
Brad King
0a34bde140 Merge topic 'flang-windows' into release-3.25
166bc00399 LLVMFlang: Add a required line to define linking rules on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7818
2022-10-25 10:33:19 -04:00
مهدي شينون (Mehdi Chinoune)
166bc00399 LLVMFlang: Add a required line to define linking rules on Windows
This was missed in commit d34e5a98b8 (LLVMFlang: Add support for
Windows, 2022-09-18, v3.25.0-rc1~102^2).
2022-10-24 12:53:07 -04:00
Brad King
077e42fe76 Merge topic 'android-path-suffixes' into release-3.25
7e5b48a7b1 Android: Avoid searching API level directories matching architecture bitness

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7805
2022-10-19 09:55:59 -04:00
Sergiu Deitsch
7e5b48a7b1 Android: Avoid searching API level directories matching architecture bitness
When cross-compiling for Android, the library path suffixes `/<number>/`
refer to API level specific platform libraries instead of architecture
bitness. Disable path suffix use under NDK to avoid incorrect inclusion
of API level specific libraries below the targeted API level.

Fixes: #23830
2022-10-18 14:21:51 -04:00
Andrew Kaster
4fa0d157bc SerenityOS: Unset CMAKE_DL_LIBS because LibDl no longer exists
Serenity's LibDl was merged into LibC to simplify the build and port
infrastructure [1].  Set `CMAKE_DL_LIBS` to the empty string to match
what other platforms do.  Update the platform module added by
commit 45ca894164 (SerenityOS: Add Platform module, 2022-01-02,
v3.25.0-rc1~635^2).

[1] https://github.com/SerenityOS/serenity/pull/14854

Issue: #23589
2022-10-17 10:13:47 -04:00
Gergely Meszaros
5b87ae6e2d HIP, Windows: Add Windows-Clang-HIP platform module
Add a platform module for using clang for HIP on windows, based on the
CXX module.

HIP language on windows works without this, but mixing with MSVC
produces catastrofical results.
Add the same restriction with HIP as C and C++ had prior:
Either none are compiled with MSVC or all are.

clang-cl support for HIP does not work yet: it needs more work in both
hip-lang-config.cmake and cmake itself.
2022-10-09 20:03:28 +02:00
Brad King
d563bfa2df Merge topic 'flang-windows'
d34e5a98b8 LLVMFlang: Add support for Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7692
2022-09-23 08:42:21 -04:00
مهدي شينون (Mehdi Chinoune)
d34e5a98b8 LLVMFlang: Add support for Windows 2022-09-21 12:57:16 +01:00
Yonggang Luo
be848a71b0 MSVC: Teach find_library to consider the 'libfoo.a' naming convention
When targeting the GNU ABI, we consider `.a` libraries first but also
accept `.lib`.  For symmetry, when targeting the MSVC ABI, we now
consider `.lib` first but also accept `.a`.

This adds support for meson-generated static libraries, which are named
with the pattern `lib${foo}.a`:

* https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa

Fixes: #23975
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2022-09-19 11:02:44 -04:00
Brad King
c3e68020d6 Merge topic 'MsvcDebugInformationFormatAbstraction'
a858466aac MSVC: Add test for debug information format
0e96a20478 MSVC: Add abstraction for debug information format
d4c8111da4 Clang/Windows: Clarify name of internal runtime library flags variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7606
2022-09-14 09:21:27 -04:00
Glen Chung
0e96a20478 MSVC: Add abstraction for debug information format
Replace our hard-coded default for `/Zi` with a first-class abstraction
to select the debug information format an enumeration of logical
names.  We've long hesitated to do this because the idea of "debug
information format" touches on related concepts on several platforms.
Avoid that scope creep by simply defining an abstraction that applies
only when targeting the MSVC ABI on Windows.

Removing the old default flag requires a policy because existing
projects may rely on string processing to edit them and choose a
runtime library under the old behavior.  Add policy CMP0141 to
provide compatibility.

Fixes: #10189
2022-09-14 09:12:47 -04:00
Marc Chevrier
90874a542e Intel classic compilers on Windows: use msvc style dependencies
Intel classic compilers generate erroneous dependencies when gcc style
is used with paths containing spaces. So, fall back to the old way to
generate dependencies by using option /showIncludes.

Fixes: #23948
2022-09-13 17:47:01 +02:00
Brad King
d4c8111da4 Clang/Windows: Clarify name of internal runtime library flags variables
Also avoid extra spaces in resulting flag strings.
2022-09-13 11:19:07 -04:00
Cristian Adam
288f72efea BSD: Only use BSD as variable for target BSD system
Instead of having multiple boolean variables, we only have one
string variable: BSD with the name of the target BSD system.

Relates: #23853
2022-09-06 01:02:34 +02:00
Craig Scott
a8b274c74e Merge topic 'bsd-variables'
a20d7a9707 BSD: Set *BSD variables when targeting a *BSD system
2ae42d0aa3 kFreeBSD: Do not unset LINUX variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7573
2022-08-22 17:37:49 -04:00
Cristian Adam
a20d7a9707 BSD: Set *BSD variables when targeting a *BSD system
Fixes: #23853
2022-08-21 09:27:59 +10:00
Cristian Adam
2ae42d0aa3 kFreeBSD: Do not unset LINUX variable
kFreeBSD is a Debian GNU distribution with a kernel from FreeBSD,
and should be marked as LINUX.
2022-08-21 09:27:35 +10:00
Brad King
4a82938d60 Merge topic 'nvhpc_fpie_support'
52dc49deb9 NVHPC: Enable PIE support on linux

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !7564
2022-08-16 13:01:31 -04:00
Brad King
90607d182c Merge topic 'mingw-windres'
e9755bc7c1 MinGW: Restore using windres when toolchain-prefixed name is not available

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7574
2022-08-16 12:43:53 -04:00
Brad King
e9755bc7c1 MinGW: Restore using windres when toolchain-prefixed name is not available
Since commit 55ba10dcfd (MSYS/MinGW Makefiles: Simplify selection of
windres as Resource Compiler, 2022-05-26, v3.24.0-rc1~82^2) the `MinGW
Makefiles` and `MSYS Makefiles` generators no longer specify the plain
`windres` name for the MinGW resource compiler.  Instead, the name is
specified in our MinGW platform information module. After the change in
commit af4adf6aa9 (MinGW: Fix default windres selection when
cross-compiling, 2020-03-25, v3.18.0-rc1~492^2), when cross-compiling,
we only specify the toolchain-prefixed name of the tool, which may not
be available in all environments.

If the toolchain-prefixed name is not available, fall back to the plain
`windres` name.  We already use this approach for other binutils.

Fixes: #23841
2022-08-15 13:57:58 -04:00
Robert Maynard
52dc49deb9 NVHPC: Enable PIE support on linux 2022-08-15 13:39:30 -04:00
Cristian Adam
62cd3904bf variable: Set LINUX variable on Linux target systems
Fixes: #23840
2022-08-12 07:20:05 +10:00
William R. Dieter
6823db0c5a Enable IPO for IntelLLVM compilers on Linux and Windows
Replicate and adapt Linux IPO options for Intel for IntelLLVM compilers
on Linux and Windows.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-08-01 19:34:49 -04:00
William R. Dieter
5d5a712303 IntelLLVM: Pass linker flags to the compiler when used as linker
When linking an executable, DLL, or static library, the compiler sometimes
needs to see the linking options.  Typically `<FLAGS>` is not passed
for linking, because some of the options are only used for compilation.
Previously, `<LINK_FLAGS>` was passed after the `/link` flag because
the compiler did not understand some of the linking options.

This change wraps the initial linker options borrowed from Windows-MSVC
individually, so that they are passed directly to the linker.

This change is helpful both for interprocedural optimization, which needs
to pass `-Qipo` to the compiler at link time, and for SYCL which needs
to pass `-fsycl` and possibly other options to the compiler at link time.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-08-01 19:34:49 -04:00
William Marlow
74e3ac2b7e AIX: Export symbols from IBMClang IPA objects
When interprocedural analysis is enabled on the IBMClang family of
compilers (via the `-flto` option) then the resulting object files
contain LLVM IR rather than XCOFF objects[1].

ExportImportList needs to detect LLVM IR objects and use the
`ibm-llvm-nm` tool that ships with the compiler to create the extract
the defined symbols.

Without this change, such objects result in an error message from
`dump` and no symbols being exported from the object file.

[1]: https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.0?topic=compatibility-link-time-optimization-lto
2022-07-12 07:41:25 +01:00
Craig Scott
c86c99fb54 Merge topic 'LINK_LIBRARY-Darwin-LIBRARY-features-enhancements'
537861664a Genex LINK_LIBRARY: MacOS: enhance *_LIBRARY features
c55d42eb42 Darwin.cmake: Fix indenting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7433
2022-07-04 23:53:14 -04:00
Marc Chevrier
537861664a Genex LINK_LIBRARY: MacOS: enhance *_LIBRARY features 2022-07-03 14:43:23 +10:00
Craig Scott
c55d42eb42 Darwin.cmake: Fix indenting 2022-07-03 14:43:23 +10:00
Brad King
808cbb7162 Merge topic 'lcc-liblfortran-renamed'
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7407
2022-06-28 09:15:24 -04:00
Brad King
746bed40f2 Merge topic 'lcc-liblfortran-renamed' into release-3.24
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7407
2022-06-28 09:15:23 -04:00
Igor Molchanov
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03
Since LCC 1.26.03, compiler developers decided to rename
liblfortran to libgfortran (internal reference: mcstbug#131633),
and despite it's stated that "-llfortran will be automatically
treated as -lgfortran", it actually does not work (and there's
even no symlinks like liblfortran.* -> libgfortran.*); so we
have to explicitly choose which library we have to link in.

Fixes: #23646
2022-06-27 13:02:53 -04:00
Andrew Kaster
45ca894164 SerenityOS: Add Platform module
Add an initial Platform module for SerenityOS [1]. This module is a mix
of the platform module currently used to build the Serenity Kernel and
Userspace applications and libraries, and the platform module included
in the CMake Port [2] which still has some work to do on the system
before its other patches could be considered for upstream.

As such, the platform module is currently only useful when used with a
suitably patched GCC or LLVM cross-compiler toolchain.

[1] https://github.com/SerenityOS/serenity
[2] https://github.com/SerenityOS/serenity/tree/master/Ports/cmake/patches

Issue: #23589
2022-06-14 15:31:17 -04:00
Brad King
7d73e88d3a MSVC: Revert "Default to -ZI instead of /Zi for x86 and x64"
Revert commit 5fcadc481e (MSVC: Default to -ZI instead of /Zi for x86
and x64, 2022-05-24).  The `-ZI` flag is incompatible with the `-GL`
flag used for IPO, and so is not an unconditionally better default.
Revert the change pending future design of a first-class setting for
MSVC debug info format that can be automatically reconciled with IPO
settings.

That commit introduced policy CMP0138, but we already have later policy
numbers used too.  Leave placeholder text to avoid policy renumbering.

Issue: #23607, #10189
2022-06-09 12:24:33 -04:00
Glen Chung
5fcadc481e MSVC: Default to -ZI instead of /Zi for x86 and x64
Add a policy for compatibility.

For more information, see [1].

[1] https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170

Fixes: #10189
2022-05-26 09:06:01 -04:00
Brad King
faed1562fb Merge branch 'backport-3.23-clang-imsvc' into clang-imsvc 2022-05-17 11:20:15 -04:00
Brad King
23a52561c7 Clang: Use -imsvc flag without space to support Clang tools
Since commit bb61c2d024 (Clang: use -imsvc for system include dirs when
running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we use the `-imsvc`
flag followed by the include directory as a separate argument.  Some
versions of `clang-tidy` do not support the flag unless the include
directory is attached to it, so use that form instead.

A similar fix was made by commit 3a8b6653dc (MSVC: Use -external:I flag
without space to support Clang tools, 2022-01-11, v3.22.2~8^2).

Fixes: #23517
2022-05-17 11:09:15 -04:00
Brad King
79b64690d9 Merge topic 'werror-property'
76a08cd253 COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errors

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Michael Hirsch <michael@scivision.dev>
Merge-request: !7187
2022-05-10 10:30:42 -04:00
Martin Duffy
76a08cd253 COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errors
Add `COMPILE_WARNING_AS_ERROR` target property and supporting
`CMAKE_COMPILE_WARNING_AS_ERROR` variable.

`COMPILE_WARNING_AS_ERROR` is initialized by
`CMAKE_COMPILE_WARNING_AS_ERROR`. It is a boolean variable. If it is
true, it expands to a different flag depending on the compiler such that
any warnings at compile will be treated as errors.

Supports compiler ids that I could find a relevant flag for.
2022-05-06 12:14:37 -04:00
Cameron Cawley
6a2b016bbd OpenWatcom: Support CMAKE_WATCOM_RUNTIME_LIBRARY with Linux and OS/2 builds 2022-05-06 10:40:59 -04:00
Cameron Cawley
33da5824ac OpenWatcom: Allow specifying the runtime library
Add a `CMAKE_WATCOM_RUNTIME_LIBRARY` variable to control the
runtime library selection.  Add policy CMP0136 to switch to
in place of the old hard-coded default flags.

Fixes: #23178
2022-05-06 10:40:58 -04:00
Brad King
bd8acc3a1b Merge topic 'clang-cl-asm-msvc-runtime'
b41fab9285 Clang: populate MSVC runtime library abstraction table

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7048
2022-04-22 09:01:35 -04:00
Saleem Abdulrasool
b41fab9285 Clang: populate MSVC runtime library abstraction table
!3211 overlooked populating the runtime library selection flags for
clang-cl in MSVC compatibility mode.  There is no flag that needs to be
passed, but the value is expected to be available by the generators.  We
simply provide the empty string to appease the generators without
emitting any additional flags.

Fixes: #23048
2022-04-17 21:13:44 -07:00
Robert Maynard
42f7e39789 Find: Support per call disabling of CMAKE_INSTALL_PREFIX
Fixes #23359
2022-04-15 09:33:55 -04:00
Chris Wright
87142bbd5f ADSP: Add dedicated platform module 2022-04-04 17:05:09 +01:00
Marc Chevrier
d658332782 Genex-LINK_GROUP: Add support feature RESCAN on BSD systems 2022-03-22 11:36:10 +01:00
Brad King
7e642a6fa0 Merge topic 'ghs_predefined_targets'
399e73b89a GHS: release note
829e946c69 GHS: Update tests for updated binary layout
93c1acd8ff GHS: List predefined targets before user targets in GUI
bdb213819c GHS: Do not include WindowsPaths
b3e9c72901 GHS: use INSTALL target
a645287784 GHS: update build command
724b5491ef GHS: Rearrange project files in binary directory
edff0f6a1d GHS: Use Custom Target for ALL_BUILD
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7079
2022-03-21 14:36:42 -04:00
Fred Baksik
bdb213819c GHS: Do not include WindowsPaths
This causes issues where CMAKE_SYSTEM_PREFIX_PATH contains incorrect
paths. GHS is a cross-compiler toolchain and doesn't use anything in
these locations.

Also WindowsPaths are always wrong on Linux hosts.
2022-03-17 19:11:46 -04:00
Marc Chevrier
dabe56de58 genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVE 2022-03-17 23:07:59 +01:00
Brad King
49642079e5 Merge topic 'LINK_LIBRARY-libraries'
9fb1dff070 LINK_LIBRARY: Add features for library support on Apple
93a153bc7f Genx-LINK_LIBRARY: simplify framework features definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7029
2022-03-07 10:04:13 -05:00