24 Commits
Author SHA1 Message Date
Dimitri Papadopoulos 44e83e9180 Fix typos not found by codespell 2024-06-20 20:16:25 +02:00
Tobias Hieta 979b047114 Disable linker flag detection on MSVC/ClangCL.
This fixes compilation with clang-cl on Windows. There
is a bug in cmake so that check_linker_flag() doesn't give
the correct result when using link.exe/lld-link.exe.

Details in CMake's gitlab: https://gitlab.kitware.com/cmake/cmake/-/issues/22023

Fixes #3522
2023-03-22 22:13:57 +01:00
Sutou KouheiandNick Terrell 8420502ef9 Don't require CMake 3.18 or later
fix #3500

CMake 3.18 or later was required by #3392. Because it uses
`CheckLinkerFlag`. But requiring CMake 3.18 or later is a bit
aggressive. Because Ubuntu 20.04 LTS still uses CMake 3.16.3:
https://packages.ubuntu.com/search?keywords=cmake

This change disables `-z noexecstack` check with old CMake. This will
not break any existing users. Because users who need `-z noexecstack`
must already use CMake 3.18 or later.
2023-02-16 10:08:45 -08:00
Yann Collet 6640377783 cmake build: fix nit
reported by @jaimeMF in https://github.com/facebook/zstd/pull/3392#discussion_r1056643794
2022-12-23 14:18:11 -08:00
Nick TerrellandNick Terrell 31a703ec13 [cmake] Add noexecstack to compiler/linker flags 2022-12-21 17:30:14 -08:00
Andrea Pappacoda a0b09d0ff7 build(cmake): improve pkg-config generation
With this patch the pkg-config generation when using the CMake build
system is improved in the following ways:

- Libs.private is now filled when needed
- The JoinPaths module is now used to join paths, leading to simpler
  code
- The .pc file is always generated, regardless of the platform, as it
  can also be consumed on Windows

Here's how the .pc file is affected by these changes, in comparison to
the one generated with the official Makefiles:

    $ diff -s lib/libzstd.pc build/cmake/build-old/lib/libzstd.pc
    15c15
    < Libs.private: -pthread
    ---
    > Libs.private:

    $ diff -s lib/libzstd.pc build/cmake/build-new/lib/libzstd.pc
    Files lib/libzstd.pc and build/cmake/build-new/lib/libzstd.pc are
    identical
2022-08-28 13:24:30 +02:00
Yann Collet eceecc5b2c removed explicit compilation standard from cmake script
it's not expected to be useful
and can actually lead to subtle side effects
such as #3163.
2022-06-19 14:52:32 -07:00
Nick Hutchinson 2d34062836 CMake: fix excessive build warnings when building with clang-cl 2021-05-06 18:46:37 +01:00
Bimba Shrestha 0fa9406ae2 removing deduplicatin of flags 2020-06-15 14:58:53 -07:00
Nick TerrellandNick Terrell 3ed0f65158 [cmake] Add playTests.sh as a test 2020-01-13 14:16:15 -08:00
l00292966andl00292966 b31df043a0 add cmake lz4 support
add some instructions for build/cmake/README.md
2019-06-03 18:22:50 +08:00
Hans Johnson 97d1de3d22 Provide forward compatible cmake paradigms
Automatically extract version information
from the zstd.h file.  Use naming of variables
consisent with modern cmake and https://semver.org/
(Semantic Versioning 2.0.0, MAJOR, MINOR, PATCH)

Modern versions of cmake provide consistent
paradigms for configuring project external
interface values.

This set of changes provide a back port of
some of cmake 3+ paradigms back to cmake 2.8.9.
Set and allow use of the current cmake policies
for newer versions of cmake when available to
allow for modern compiler features to be
utilized when available.

NOTE: The intent is that future modifications to
cmake will enable (conditional on cmake version support)
the ability to support modern linkage, and target
export mechanisms.  Those future changes will
make incorporating zstd into other packages
much easier.

This patch also allows the more rigourous error
checking of commmon cmake errors to be preformed
by cmake (i.e. more stringent syntax checking and
create errors for common hard to find misuses of
cmake variables).

This patch also provides support for modern
compiler support options by cmake (like
enabling interprocedural optimization
if link time optimizations are known to be supported
by the compiler envirionment.  IPO can be supported
by setting the CMAKE_INTERPROCEDURAL_OPTIMIZATION variable
for newer versions of cmake.
2018-12-28 13:47:35 -06:00
Hans Johnson 1a279ae85a BUG: list sub-command REMOVE_DUPLICATES requires list to be present
When compiling without c++ enabled, some variables are not present.
This is a check enforced in recent Cmake versions.

CMake Error at CMakeModules/AddZstdCompilationFlags.cmake:54 (list):
  list sub-command REMOVE_DUPLICATES requires list to be present.
Call Stack (most recent call first):
  CMakeLists.txt:53 (ADD_ZSTD_COMPILATION_FLAGS)
2018-12-26 13:26:59 -06:00
Hans Johnson d3fc848ddd STYLE: Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the block.
This is no longer the preferred style.
2018-12-22 19:32:39 -06:00
Hans Johnson 2f1ff84119 STYLE: Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command names
became case-insensitive.  Now the preferred style is lower-case.
2018-12-22 19:32:39 -06:00
codicodi e87cad1053 CMake improvements 2017-05-24 10:56:35 +02:00
Michael Maltese 9eda436733 CMake: don't modify global C_FLAGS and CXX_FLAGS 2017-04-20 19:30:38 -07:00
Michael Maltese 377401f161 CMake: don't recheck compile flags every time
Doesn't cause a problem when embedded within a larger project, but is
annoying.
2017-04-20 19:30:38 -07:00
Michael Maltese 7f1fb95566 CMake: namespace modules and set CMAKE_MODULE_PATH 2017-04-20 19:30:37 -07:00
Sean Purcell f7a78609e7 CMake: Fix version parsing and allow Unix flags on Clang 2017-03-21 13:44:33 -07:00
Milan Ševčík 0184d80e8e Refactored AddExtraCompilationFlags
- Easier addition of new flags
 - Removed flags not used by default
 - Removed implicit PIC flag for all targets
2017-03-21 10:43:08 +01:00
Milan Ševčík 623baf513e Move GetLibraryVersion function to its own module file 2017-03-21 10:38:48 +01:00
Milan Ševčík eeb080e601 -Wstrict-prototypes is not supported with C++ 2017-02-28 10:57:09 +01:00
Yann Collet 4c9a4c18a9 changed projects to build 2016-09-19 14:58:14 +02:00