cmark

My personal build of CMark ✏️

Commit
3113c42ac34c9ea88a555c05ac91bde7f56f9dcc
Parent
3cad10545eca566bcf6c2bc3b5dd8b577a70493d
Author
Saleem Abdulrasool <compnerd@compnerd.org>
Date

build: reduce property computation in CMake

This reduces the work that CMake needs to do to configure the libraries by setting all the properties at once.

Diffstat

1 file changed, 7 insertions, 18 deletions

Status File Name N° Changes Insertions Deletions
Modified src/CMakeLists.txt 25 7 18
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -64,18 +64,15 @@ endif()
 
 if (CMARK_SHARED)
   add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES})
-  # Include minor version and patch level in soname for now.
   set_target_properties(${LIBRARY} PROPERTIES
+    MACOSX_RPATH TRUE
     OUTPUT_NAME "cmark"
+    # Avoid name clash between PROGRAM and LIBRARY pdb files.
+    PDB_NAME cmark_dll
+    # Include minor version and patch level in soname for now.
     SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
     VERSION ${PROJECT_VERSION})
 
-  set_property(TARGET ${LIBRARY}
-    APPEND PROPERTY MACOSX_RPATH true)
-
-  # Avoid name clash between PROGRAM and LIBRARY pdb files.
-  set_target_properties(${LIBRARY} PROPERTIES PDB_NAME cmark_dll)
-
   generate_export_header(${LIBRARY}
     BASE_NAME ${PROJECT_NAME})
 
@@ -86,17 +83,9 @@ if (CMARK_STATIC)
   add_library(${STATICLIBRARY} STATIC ${LIBRARY_SOURCES})
   set_target_properties(${STATICLIBRARY} PROPERTIES
     COMPILE_FLAGS -DCMARK_STATIC_DEFINE
-    POSITION_INDEPENDENT_CODE ON)
-
-  if (MSVC)
-    set_target_properties(${STATICLIBRARY} PROPERTIES
-      OUTPUT_NAME "cmark_static"
-      VERSION ${PROJECT_VERSION})
-  else()
-    set_target_properties(${STATICLIBRARY} PROPERTIES
-      OUTPUT_NAME "cmark"
-      VERSION ${PROJECT_VERSION})
-  endif(MSVC)
+    OUTPUT_NAME "cmark$<$<BOOL:MSVC>:_static>"
+    POSITION_INDEPENDENT_CODE ON
+    VERSION ${PROJECT_VERSION})
 
   if (NOT CMARK_SHARED)
     generate_export_header(${STATICLIBRARY}