summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-12-22 11:22:05 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-01-02 22:58:05 -0700
commit3113c42ac34c9ea88a555c05ac91bde7f56f9dcc (patch)
tree9484b27cee7d9f533367a7e7eddeb6a86b041ebf
parent3cad10545eca566bcf6c2bc3b5dd8b577a70493d (diff)
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.
-rw-r--r--src/CMakeLists.txt25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d864f59..257fbe0 100644
--- 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}