summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKevin Adler <kadler@us.ibm.com>2020-11-02 11:21:17 -0600
committerKevin Adler <kadler@us.ibm.com>2020-11-13 15:40:51 -0600
commit1cb029b33cefe5a5937ca446a00528787f5bafe4 (patch)
treeda0a09e49cdd8ecebc404a9f7503e3be52f79e57 /CMakeLists.txt
parent3094b5c289b418b31e63ad2e7f52a38cf64e3dfc (diff)
downloadninja-1cb029b33cefe5a5937ca446a00528787f5bafe4.tar.gz
Use internal getopt for IBM i and AIX
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e02849d..efc4090 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,6 +112,9 @@ if(WIN32)
endif()
else()
target_sources(libninja PRIVATE src/subprocess-posix.cc)
+ if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ target_sources(libninja PRIVATE src/getopt.c)
+ endif()
endif()
#Fixes GetActiveProcessorCount on MinGW
@@ -119,11 +122,10 @@ 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")
+# On IBM i (identified as "OS400" for compatibility reasons) and AIX, this fixes missing
+# PRId64 (and others) at compile time in C++ sources
+if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
string(APPEND CMAKE_CXX_FLAGS " -D__STDC_FORMAT_MACROS")
- string(APPEND CMAKE_EXE_LINKER_FLAGS " -lutil")
endif()
# Main executable is library plus main() function.