Skip to content

Commit ee4408b

Browse files
committed
actually needs C90 say for Intel oneAPI
1 parent 8770e9e commit ee4408b

File tree

2 files changed

+16
-70
lines changed

2 files changed

+16
-70
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND GKlib_IS_TOP_LEVEL)
2020
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/local" CACHE PATH "install prefix" FORCE)
2121
endif()
2222

23-
set(CMAKE_C_STANDARD 99)
23+
set(CMAKE_C_STANDARD 90)
2424

2525
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} Arch: ${CMAKE_SYSTEM_PROCESSOR} install prefix: ${CMAKE_INSTALL_PREFIX}")
2626

GKlibSystem.cmake

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
# Helper modules.
2-
include(CheckFunctionExists)
3-
include(CheckIncludeFile)
4-
5-
# Setup options.
6-
option(OPENMP "enable OpenMP support" OFF)
7-
option(PCRE "enable PCRE support" OFF)
8-
option(GKREGEX "enable GKREGEX support" OFF)
9-
option(GKRAND "enable GKRAND support" OFF)
10-
112

123
# Add compiler flags.
134
if(MSVC)
145
set(GKlib_COPTIONS WIN32 MSC _CRT_SECURE_NO_DEPRECATE USE_GKREGEX)
15-
elseif(WIN32)
6+
elseif(MINGW)
167
set(GKlib_COPTIONS USE_GKREGEX)
178
else()
18-
set(GKlib_COPTIONS LINUX FILE_OFFSET_BITS=64)
9+
set(GKlib_COPTIONS LINUX _FILE_OFFSET_BITS=64)
1910
endif(MSVC)
2011

2112
if(CYGWIN)
2213
list(APPEND GKlib_COPTIONS CYGWIN)
23-
endif()
14+
endif(CYGWIN)
2415

25-
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
26-
list(APPEND GKlib_COPTS -fno-strict-aliasing -Wall -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label)
16+
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
17+
# GCC opts.
18+
list(APPEND GKlib_COPTS -fno-strict-aliasing)
19+
20+
# if(VALGRIND)
21+
# list(APPEND GKlib_COPTS -march=x86-64 -mtune=generic)
22+
# else()
23+
# list(APPEND GKlib_COPTS -march=native)
24+
# endif(VALGRIND)
2725
endif()
2826

2927
if(UNIX)
@@ -32,63 +30,11 @@ check_pie_supported()
3230
set(CMAKE_POSITION_INDEPENDENT_CODE true)
3331
endif()
3432

35-
# Find OpenMP if it is requested.
36-
if(OPENMP)
37-
find_package(OpenMP REQUIRED)
38-
list(APPEND GKlib_COPTIONS __OPENMP__)
39-
endif()
40-
4133
# Set the CPU type
42-
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
43-
list(APPEND GKlib_COPTIONS NO_X86=1)
44-
endif()
45-
46-
# Add various options
47-
if(PCRE)
48-
list(APPEND GKlib_COPTIONS __WITHPCRE__)
49-
endif()
50-
51-
if(GKREGEX)
52-
list(APPEND GKlib_COPTIONS USE_GKREGEX)
53-
endif()
54-
55-
if(GKRAND)
56-
list(APPEND GKlib_COPTIONS USE_GKRAND)
57-
endif()
58-
59-
60-
# Check for features.
61-
check_include_file(execinfo.h HAVE_EXECINFO_H)
62-
if(HAVE_EXECINFO_H)
63-
list(APPEND GKlib_COPTIONS HAVE_EXECINFO_H)
64-
endif(HAVE_EXECINFO_H)
34+
if(NO_X86)
35+
list(APPEND GKlib_COPTS -DNO_X86=${NO_X86})
36+
endif(NO_X86)
6537

66-
check_function_exists(getline HAVE_GETLINE)
67-
if(HAVE_GETLINE)
68-
list(APPEND GKlib_COPTIONS HAVE_GETLINE)
69-
endif(HAVE_GETLINE)
70-
71-
72-
# Custom check for TLS.
73-
if(MSVC)
74-
list(APPEND GKlib_COPTIONS __thread=__declspec(thread))
75-
76-
# This if checks if that value is cached or not.
77-
if("${HAVE_THREADLOCALSTORAGE}" MATCHES "^${HAVE_THREADLOCALSTORAGE}$")
78-
message(CHECK_START "checking for thread-local storage")
79-
try_compile(HAVE_THREADLOCALSTORAGE
80-
${CMAKE_BINARY_DIR}
81-
${GKLIB_PATH}/conf/check_thread_storage.c)
82-
if(HAVE_THREADLOCALSTORAGE)
83-
message(CHECK_PASS "found")
84-
else()
85-
message(CHECK_FAIL "not found")
86-
endif()
87-
endif()
88-
if(NOT HAVE_THREADLOCALSTORAGE)
89-
list(APPEND GKlib_COPTIONS __thread=)
90-
endif()
91-
endif()
9238

9339
# Finally set the official C flags.
9440
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${GKlib_COPTS}>")

0 commit comments

Comments
 (0)