summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* correction to #2360scivision2024-01-161-3/+3
| | | | | in general, flags check have to be to the non-no option. Updates use of deprecated CMake command.
* [FIX] compile: gcc version > 11.3, treat -Wmaybe-uninitialized as erroryourfather2023-12-301-0/+10
|
* Merge pull request #1562 from jhasse/googletestJan Niklas Hasse2023-11-221-1/+30
|\ | | | | Use GoogleTest instead of our own framework
| * CMakeLists.txt: Use GTest::gtest instead of gtestDavid 'Digit' Turner2023-11-161-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the case where GTEST_ROOT is set to point to a local GoogleTest installation (see example below). Note that this needs a work-around for a subtle GTest 1.10.0: - When downloading, building then installing googletest-1.10.0, the installation directory contains CMake files that are picked later by Ninja's find_package() function properly, and which define the GTest::gtest target. This is the target name that should be used by projects that depend on GoogleTest, per the official documentation. - When instead 1.10.0, i.e. the same version, is downloaded and used locally with FetchContent_Declare() + FetchContent_MakeAvailable(), then only the `gtest` target will be defined. This was fixed in 1.11.0, where this use case properly defines GTest::gtest instead. The work-around checks for the definition of GTest::gtest after the FetchContent_MakeAvailable(googletest) call. If not defined, an alias to `gtest` is created instead. This ensures the code works with more recent GoogleTest releases as well.
| * Revert back to GoogleTest 1.10.0 for RHEL 7Jan Niklas Hasse2023-10-121-2/+2
| |
| * Update GoogleTest to last release to support C++11Jan Niklas Hasse2023-10-121-2/+2
| |
| * Merge branch 'master' into googletestJan Niklas Hasse2023-10-121-11/+53
| |\
| * \ Merge branch 'master' into googletestJan Niklas Hasse2021-11-161-19/+41
| |\ \
| * | | GoogleTest 1.11.0 now requires linking pthread on LinuxJan Niklas Hasse2021-11-161-1/+2
| | | |
| * | | Use GoogleTest instead of our own frameworkJan Niklas Hasse2020-11-181-1/+12
| | | | | | | | | | | | | | | | Fixes #1248.
* | | | fixup!Shao-Ce SUN2023-10-231-5/+7
| | | |
* | | | Add a check for re2c versionShao-Ce SUN2023-10-231-2/+5
| |_|/ |/| |
* | | Fix check of filename lengthDaniel Brondani2023-09-071-1/+2
| | |
* | | CMakeLists: Fix ppoll() feature detection.David 'Digit' Turner2023-05-101-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | Use check_cxx_symbol_exists() instead of check_symbol_exists() for the subtle reason explained in the comment added in this patch. Change-Id: Id949b8f2c7af39eeef3a848d3bdbc7639432f38a
* | | Enable ppoll() usage when available.David 'Digit' Turner2023-04-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch modifies the CMakeLists.txt file to probe for ppoll() on the target system, and define -DUSE_PPOLL=1 if it is available. This can be disabled by setting -DNINJA_FORCE_PSELECT=ON when invoking CMake. This matches the default behavior of the configure.py script (and its `--force-pselect` option). Note that there is no noticeable performance difference before build commands are launched, so this change is very hard to benchmark properly. Fix for https://github.com/ninja-build/ninja/issues/1821
* | | Add overridable parameter for name of Python binary (#2224)William Kent2022-12-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add overridable parameter for name of Python binary On macOS, python is not an available command any more. python3 is. * Use option() as requested * Store variable in different way
* | | Compile getopt as a C++ file, so that CMake need not look for a C compiler ↵Michael Jones2022-08-241-1/+9
| | | | | | | | | | | | at all
* | | Build ninja with C++11 (#2089)Bruce Dawson2022-06-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Build ninja with C++11 In order to allow future use of std::chrono to make the stats code portable it is desirable to compile with C++11. Doing so also allows use of std::unordered_map, and reduces the number of #ifdefs in the ninja source code. Switching to C++11 requires modifying both CMakeLists.txt and configure.py, for MSVC and for other build systems. For MSVC the required change is adding /Zc:__cplusplus to tell the compiler to give a more accurate value for the __cplusplus macro. For other platforms the change is to add -std=c++11 or the CMake equivalent. This change makes some progress towards resolving issue #2004. * Delete code and instructions C++11 guarantees that string::data() gives null-terminated pointers, so explicitly adding a null terminator is no longer needed. The Google C++ Style Guide already recommends avoiding unnecessary use of C++14 and C++17 so repeating this in CONTRIBUTING.md is not critical. These changes both came from PR-review suggestions. * Only set cxx_std_11 if standard is 98 * Return to unconditional target_compile_features use After much discussion it sounds like using target_compile_features unconditionally is best.
* | | Add an option to avoid building binary when used as a libraryKen Matsui2022-06-101-7/+15
| | |
* | | cmake: remove unnecessary install parameterMichael Hirsch2022-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | The install(TARGETS ... DESTINATION bin) is not necessary as this subdirectory is implicit for executable targets. ref: https://cmake.org/cmake/help/v3.15/command/install.html
* | | Disable re2c from embedding the version number in the source fileMarc-Antoine Ruel2021-12-311-1/+1
| |/ |/| | | | | | | | | | | | | | | The checked in sources (depfile_parser.cc and lexer.cc) have the re2c version embedded in it. The output didn't change since re2c 1.3, except for the different version number. A reproducible build would use a pinned version of re2c anyway, so there is no need to hardcode its value in the checked in generated files.
* | minidump-win32 is needed by native GNU-like Clang on WindowsMichael Hirsch2021-11-031-3/+1
| | | | | | | | | | | | | | The entire minidump-win32.cc is guarded by ifdef _MSC_VER, so MSYS2/MinGW will just ignore the contents. fixes #2006
* | compdb: escape control characters in JSON stringsLi-Yu Yu2021-07-221-0/+2
| |
* | cmake: use `check_symbol_exists` for browse supportBen Boeckel2021-06-021-5/+10
| | | | | | | | | | | | Just because `unistd.h` exists does not mean it has the APIs that are needed. This occurs when cross-compiling using Fedora's packaged MinGW toolchain.
* | cmake: add browse check statusMichael Hirsch2021-02-231-0/+8
| |
* | Merge pull request #1331 from ilor/missingdeps3Jan Niklas Hasse2021-02-231-0/+2
|\ \ | | | | | | missingdeps tool, take 2
| * | Add a -t missingdeps tool to detect some classes of build flakesTomasz Śniatowski2021-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tool looks for targets that depend on a generated file, but do not properly specify a dependency on the generator. It needs to be run after a successful build, and will list all potential flakes that may have broken the build, but didn't due to accidental build step ordering. The search relies on the correctness of depfile and generator output information, but these are usually easier to get right than dependencies. The errors found can usually be verified as actual build flakes by trying to build the listed problematic files alone in a clean build directory. Such builds usually fail with a compile job lacking a generated file. There is some overlap between this tool and 'gn check', but not everyone uses gn, not everyone using gn uses gn check, and most importantly, gn check is more about modularity, and less about actual build-time deps without flakes. The tool needs to be run after a build completes and depfile data is collected. It may take several seconds to process, up to a dozen or two on a large, chromium-sized build.
* | | Merge pull request #1915 from jhasse/windows-utf8Jan Niklas Hasse2021-02-231-0/+4
|\ \ \ | | | | | | | | Use UTF-8 on Windows 10 Version 1903, fix #1195
| * | | Use UTF-8 on Windows 10 Version 1903, fix #1195Jan Niklas Hasse2021-02-171-0/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows Ninja to use descriptions, filenames and environment variables with characters outside of the ANSI codepage on Windows. Build manifests are now UTF-8 by default (this change needs to be emphasized in the release notes). WriteConsoleOutput doesn't support UTF-8, but it's deprecated on newer Windows 10 versions anyway (or as Microsoft likes to put it: "no longer a part of our ecosystem roadmap"). We'll use the VT100 sequence just as we do on Linux and macOS. https://docs.microsoft.com/en-us/windows/uwp/design/globalizing/use-utf8-code-page https://docs.microsoft.com/en-us/windows/console/writeconsoleoutput https://docs.microsoft.com/de-de/windows/console/console-virtual-terminal-sequences
* | | Merge pull request #1911 from eszlari/cmake-cleanupJan Niklas Hasse2021-02-221-13/+13
|\ \ \ | | | | | | | | cmake: add_compile_options / PROJECT_SOURCE_DIR
| * | | cmake: add_compile_options / PROJECT_SOURCE_DIRPeter Eszlari2021-02-091-13/+13
| |/ /
* | | Turn BuildStatus into an interfaceColin Cross2020-12-181-0/+1
|/ / | | | | | | | | | | Make BuildStatus an abstract interface, and move the current implementation to StatusPrinter, to make way for a serialized Status output.
* | cmake: Use modern add_test signatureGregor Jasny2020-12-111-1/+1
| | | | | | | | | | | | Using this modern signature makes CMake/CTest use the effective binary path and works also with multi-config generators which put binaries in extra `Release` folders.
* | Merge pull request #1876 from orgads/msvc-warningsJan Niklas Hasse2020-12-051-1/+3
|\ \ | |/ |/| Suppress MSVC warnings
| * Suppress MSVC warningsOrgad Shaneh2020-11-111-1/+3
| | | | | | | | | | | | | | | | | | | | * D9025: overriding '/GR' with '/GR-' * C4100: 'argc': unreferenced formal parameter * C4244: '=': conversion from 'int' to 'char', possible loss of data (on tolower) * C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data * C4702: unreachable code (after Fatal) * C4706: assignment within conditional expression * C4996: 'strcpy': This function or variable may be unsafe
* | Merge pull request #1879 from kadler/aix-cleanupJan Niklas Hasse2020-11-141-4/+17
|\ \ | | | | | | Fix building on AIX
| * | Fix test crashes on AIXKevin Adler2020-11-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both hash_collision_bench and manifest_parser_perftest crash on AIX with terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc IOT/Abort trap (core dumped) 32-bit AIX applications by default allocates only a single 256M segment for stack and heap for 32-bit applications, which is insufficient for these tests. When building these tests on AIX in 32-bit mode, increase the max number of segments so they will run without crashing.
| * | Add libperfstat to AIX CMake buildKevin Adler2020-11-131-0/+5
| | |
| * | Use internal getopt for IBM i and AIXKevin Adler2020-11-131-4/+6
| |/
* | Fix mulit-configuration bug. This affected users who usehdf89shfdfs2020-11-131-10/+8
|/ | | | multi-configuration generators for building ninja.
* cmake: Use ${CMAKE_COMMAND} instead of `cmake`Nathan Mulcahey2020-11-031-1/+1
| | | | | Not all users have `cmake` on their PATH and this causes a build failure.
* fixup: remove unneeded CMAKE_C_FLAGSJesse Gorzinski2020-10-291-1/+0
|
* build: Add IBM i compile/link flagsJesse Gorzinski2020-10-291-0/+8
|
* cmake: add BUILD_TESTING option (ON by default) (#1839)David Callu2020-09-141-39/+41
| | | | option provided by cmake's Module CTest enable_testing() is call by this Module
* CMake: Add platform checks for browse mode supportAlastair Harrison2020-08-281-10/+25
| | | | | | | Browse mode requires a number of POSIX features to be available. This commit adds configure-time checks that the 'unistd.h' header is available and that the `inline.sh` script executes successfully. If the checks pass then browse mode is enabled.
* CMake: Add support for "browse" modeAlastair Harrison2020-08-271-0/+38
| | | | | | | | | | | | | | | | Fixes ninja-build/ninja#1822, fixes ninja-build/ninja#1853 Adds support for `ninja -t browse` to CMake builds. The platform support logic is copied from configure.py, so Windows, Solaris and AIX are treated as 'unsupported' platforms. All other platforms are assumed to be supported. As discussed in #1853, when built via CMake the `ninja` executable looks for a binary called `python` in the current path, in order to launch the "browse" mode. The behaviour differs from that of the configure.py script, which looks for a python executable that has the *same name* as the python executable that invoked the configure script.
* cmake: use PROJECT_{SOURCE,BINARY}_DIR instead of CMAKE_{SOURCE,BINARY}_DIRDavid Callu2020-07-171-3/+3
| | | | | | | | | CMAKE_SOURCE_DIR refer to the full path to the top level of the current CMake source tree PROJECT_SOURCE_DIR refer to the source directory of the last call to the project() command made in the current directory scope or one of its parents when ninja is use as a subproject, the build fail because of this.
* only apply optional flags when compiler worksMichael Hirsch, Ph.D2020-04-061-1/+12
|
* cmake: append instead of set(x ...)Michael Hirsch, Ph.D2020-02-211-2/+2
|
* cmake: remove redundant cmake_policy()Michael Hirsch, Ph.D2020-02-211-2/+0
| | | | | cmake_minimum_required(VERSION 3.15) implicitly sets to NEW all policies from CMP0094 and older