cmark

My personal build of CMark ✏️

Commit
e0c3050b5389146b555f2d105244f2d42211fd5d
Parent
10e90b78c99ccc13233ef8bba98b7fbf3fe14750
Author
John MacFarlane <jgm@berkeley.edu>
Date

Workaround to add -fvisibility=hidden for older versions of cmake.

Diffstat

1 file changed, 7 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/CMakeLists.txt 9 7 2
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -61,8 +61,13 @@ add_compiler_export_flags()
 set_target_properties(${PROGRAM} PROPERTIES
   COMPILE_FLAGS -DCMARK_STATIC_DEFINE)
 
-set(CMAKE_C_VISIBILITY_PRESET hidden)
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+if (${CMAKE_MAJOR_VERSION} GREATER 1 AND ${CMAKE_MINOR_VERSION} GREATER 8)
+  set(CMAKE_C_VISIBILITY_PRESET hidden)
+  set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+endif ()
+
 add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES})
 set_target_properties(${LIBRARY}
   PROPERTIES OUTPUT_NAME "cmark")