Skip to content

Commit 96fb994

Browse files
committed
[c89stringutils/c89stringutils_string_extras.h] Fix DLL exposure ; [c89stringutils_tests/test_c89stringutils/CMakeLists.txt] Upgrade greatest.h test library ; [CMakeLists.txt] Support for MinGW and Cygwin ; [README.md] Embolden operating systems
1 parent 45c9461 commit 96fb994

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
3232
)
3333
endif (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
3434
# Set the build directories
35-
if (MSVC)
35+
if (CMAKE_SYSTEM_NAME STREQUAL "Windows"
36+
OR CMAKE_SYSTEM_NAME STREQUAL "CYGWIN"
37+
OR CMAKE_SYSTEM_NAME MATCHES "MINGW.*")
3638
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
3739
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
3840
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
3941
else ()
4042
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
4143
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
4244
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
43-
endif()
45+
endif ()
46+
4447
# configure a header file to pass the version number only
4548
configure_file(
4649
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in"

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ c89stringutils
77

88
C89 is missing some nice things. As is MSVC.
99
This adds the string related functionality for:
10-
- Windows
10+
- **Windows**
1111
- MSVC 2005
1212
- MSVC 2022 (should support all other versions also)
1313
- MinGW
14-
- Open Watcom 2.0 (including DOS target)
15-
- SunOS
16-
- Linux
17-
- BSD
18-
- macOS
14+
- Open Watcom 2.0 (including **DOS** target)
15+
- **SunOS**
16+
- **Linux**
17+
- ***BSD**
18+
- **macOS**
1919

2020
Everything is hidden behind `ifdef`s so if the compiler/OS supports the function, that function will be used instead of the one provided by this library.
2121

c89stringutils/c89stringutils_string_extras.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <stdarg.h>
1010
#include <stdio.h>
1111
#include <string.h>
12+
#include "c89stringutils_export.h"
1213

1314
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
1415
defined(__bsdi__) || defined(__DragonFly__) || defined(BSD)
@@ -69,13 +70,6 @@
6970
#endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || \
7071
defined(__NT__) */
7172

72-
#if OLD_MSVC || defined(__WATCOMC__) || defined(__CYGWIN__)
73-
#ifdef C89STRINGUTILS_EXPORT
74-
#undef C89STRINGUTILS_EXPORT
75-
#endif /* C89STRINGUTILS_EXPORT */
76-
#define C89STRINGUTILS_EXPORT __declspec(dllimport)
77-
#endif
78-
7973
#if defined(__STDC_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
8074

8175
#define HAVE_STRERRORLEN_S

c89stringutils_tests/test_c89stringutils/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ string(REPLACE " " "_" EXEC_NAME "${EXEC_NAME}")
88
set(DOWNLOAD_DIR "${PROJECT_BINARY_DIR}/test_downloads")
99
file(MAKE_DIRECTORY "${DOWNLOAD_DIR}")
1010

11-
set(GREATEST_SHA256 "aaea21b1f4f2a4be6c83109a53db910781d294d80cb36aafaa1b37c888ac883d")
11+
set(GREATEST_SHA256 "b3f89ecad2301c64c580f328cc03a74d92f4cd4bf42ab18d3d4bfb7b8be5b948")
1212
if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
1313
file(DOWNLOAD "https://raw.githubusercontent.com/SamuelMarks/greatest/cmake-and-msvc/greatest.h"
1414
"${DOWNLOAD_DIR}/greatest.h")
1515
file(SHA256 "${DOWNLOAD_DIR}/greatest.h" GREATEST_SHA256_FOUND)
1616
if (NOT GREATEST_SHA256_FOUND STREQUAL GREATEST_SHA256)
17-
message(FATAL_ERROR "SHA256 hash verification failed for \"${DOWNLOAD_DIR}/greatest.h\"\n
18-
\"${GREATEST_SHA256_FOUND}\" != \"${GREATEST_SHA256}\"")
17+
message(FATAL_ERROR "SHA256 hash verification failed for \"${DOWNLOAD_DIR}/greatest.h\"
18+
\n\"${GREATEST_SHA256_FOUND}\" != \"${GREATEST_SHA256}\"")
1919
endif (NOT GREATEST_SHA256_FOUND STREQUAL GREATEST_SHA256)
2020
endif (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
2121

@@ -33,7 +33,7 @@ add_executable("${EXEC_NAME}" "${Header_Files}" "${Source_Files}")
3333

3434
target_link_libraries("${EXEC_NAME}" PRIVATE "c89stringutils")
3535
if (NOT CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom")
36-
target_link_libraries("${EXEC_NAME}" PRIVATE "c89stringutils_compiler_flags" "c89stringutils")
36+
target_link_libraries("${EXEC_NAME}" PRIVATE "c89stringutils_compiler_flags")
3737
endif (NOT CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom")
3838
target_include_directories(
3939
"${EXEC_NAME}"

0 commit comments

Comments
 (0)