From 5203aa49ed2f86fa3bed2968f4719d9e9ce5b60f Mon Sep 17 00:00:00 2001 From: Jesse Gorzinski Date: Thu, 29 Oct 2020 10:00:47 -0500 Subject: build: Add IBM i compile/link flags --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e6bdd9..fc5931c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,14 @@ if(MINGW) target_compile_definitions(libninja PRIVATE _WIN32_WINNT=0x0601 __USE_MINGW_ANSI_STDIO=1) endif() +# On IBM i (identified as "OS400" for compatibility reasons), this fixes missing +# PRId64 (and others) at compile time, and links to libutil for getopt_long +if(CMAKE_SYSTEM_NAME STREQUAL "OS400") + string(APPEND CMAKE_CXX_FLAGS " -D__STDC_FORMAT_MACROS") + string(APPEND CMAKE_C_FLAGS " -D__STDC_FORMAT_MACROS") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -lutil") +endif() + # Main executable is library plus main() function. add_executable(ninja src/ninja.cc) target_link_libraries(ninja PRIVATE libninja libninja-re2c) -- cgit v0.12 From e74884f02614c6718898d169632078a15e532e50 Mon Sep 17 00:00:00 2001 From: Jesse Gorzinski Date: Thu, 29 Oct 2020 10:33:49 -0500 Subject: fixup: remove unneeded CMAKE_C_FLAGS --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc5931c..b0b2fef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,6 @@ endif() # PRId64 (and others) at compile time, and links to libutil for getopt_long if(CMAKE_SYSTEM_NAME STREQUAL "OS400") string(APPEND CMAKE_CXX_FLAGS " -D__STDC_FORMAT_MACROS") - string(APPEND CMAKE_C_FLAGS " -D__STDC_FORMAT_MACROS") string(APPEND CMAKE_EXE_LINKER_FLAGS " -lutil") endif() -- cgit v0.12