forked from ibmruntimes/zoslib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
106 lines (86 loc) · 2.71 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
###############################################################################
# Licensed Materials - Property of IBM
# ZOSLIB
# (C) Copyright IBM Corp. 2020. All Rights Reserved.
# US Government Users Restricted Rights - Use, duplication
# or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
###############################################################################
project(libzoslib CXX C ASM)
cmake_minimum_required(VERSION 3.5)
include_directories(BEFORE include)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
add_subdirectory(src)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
endif()
if(NOT ${BUILD_SHARED_LIBS} MATCHES "OFF")
set_target_properties(zoslib PROPERTIES OUTPUT_NAME "libzoslib")
set_target_properties(zoslib PROPERTIES SUFFIX ".so")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "" FORCE)
list(APPEND zoslib_defines
ZOSLIB_OVERRIDE_CLIB_SOCKET
_AE_BIMODAL=1
_ALL_SOURCE
_ENHANCED_ASCII_EXT=0xFFFFFFFF
_Export=extern
_LARGE_TIME_API
_OPEN_MSGQ_EXT
_OPEN_SYS_FILE_EXT=1
_OPEN_SYS_SOCK_IPV6
PATH_MAX=1024
_UNIX03_SOURCE
_UNIX03_THREADS
_UNIX03_WITHDRAWN
_XOPEN_SOURCE=600
_XOPEN_SOURCE_EXTENDED)
if(DEFINED ENV{BUILD_VERSION})
list(APPEND zoslib_defines BUILD_VERSION="$ENV{BUILD_VERSION}")
endif()
list(APPEND zoslib_cflags -Wno-parentheses -Wno-unused-value)
get_filename_component(COMP ${CMAKE_C_COMPILER} NAME CACHE)
if(${COMP} STREQUAL clang OR ${COMP} STREQUAL ibm-clang64)
list(APPEND zoslib_cflags
-m64
-march=arch10
-mtune=arch10
-fno-short-enums
-fzos-le-char-mode=ascii)
else()
list(APPEND zoslib_cflags
-q64
-qascii
-qexportall
-qgonumber
-qlongname
-qlibansi
-qfloat=IEEE
-qtune=10
-qarch=10
-qasm
-qasmlib=sys1.maclib:sys1.modgen)
# For njsc's le/math.h:
list(APPEND zoslib_defines
__static_assert=static_assert)
endif()
set(zoslib_cflags ${zoslib_cflags} ${CMAKE_CXX_FLAGS})
target_compile_definitions(zoslib PRIVATE ${zoslib_defines})
target_compile_options(zoslib PRIVATE ${zoslib_cflags})
export(TARGETS zoslib FILE lib/cmake/zoslib/addzoslib.cmake)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "." CACHE PATH "install path" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION "install/include"
FILES_MATCHING PATTERN "*")
if(NOT ${BUILD_SHARED_LIBS} MATCHES "OFF")
install(
FILES ${CMAKE_BINARY_DIR}/lib/libzoslib.x
DESTINATION "install/lib")
endif()