summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Gorzinski <jgorzins@us.ibm.com>2020-10-29 15:00:47 (GMT)
committerJesse Gorzinski <jgorzins@us.ibm.com>2020-10-29 15:00:47 (GMT)
commit5203aa49ed2f86fa3bed2968f4719d9e9ce5b60f (patch)
tree14cf45cead3fb9561403220a6ca4c20a8bb21756
parent5993141c0977f563de5e064fbbe617f9dc34bb8d (diff)
downloadNinja-5203aa49ed2f86fa3bed2968f4719d9e9ce5b60f.zip
Ninja-5203aa49ed2f86fa3bed2968f4719d9e9ce5b60f.tar.gz
Ninja-5203aa49ed2f86fa3bed2968f4719d9e9ce5b60f.tar.bz2
build: Add IBM i compile/link flags
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
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)