summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-14 12:18:18 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-14 12:18:18 -0800
commite68262dab6fb017524a4b7bafded292c34071ccc (patch)
treec10f85b7790552817a8f8feefd4a4df5ba63b116 /src/CMakeLists.txt
parentee36eb3020ccc659587e0aba743432a74e46c5d8 (diff)
Use cmake's generate_export_header.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e95422c..cad2b86 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,7 +37,7 @@ set(PROGRAM_SOURCES
main.c
)
-include_directories(. html)
+include_directories(. html ${CMAKE_CURRENT_BINARY_DIR})
if (MSVC)
set(RE2C ${CMAKE_CURRENT_SOURCE_DIR}/re2c)
@@ -52,8 +52,13 @@ else(MSVC)
COMMAND ${RE2C} --case-insensitive -b -i ${CMAKE_CURRENT_SOURCE_DIR}/scanners.re >${CMAKE_CURRENT_SOURCE_DIR}/scanners.c)
endif(MSVC)
+include (GenerateExportHeader)
+
add_executable(${PROGRAM} ${PROGRAM_SOURCES})
+add_compiler_export_flags()
+set(CMAKE_C_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES})
set_target_properties(${LIBRARY}
PROPERTIES OUTPUT_NAME "cmark")
@@ -61,19 +66,22 @@ set_target_properties(${LIBRARY}
set_property(TARGET ${LIBRARY}
APPEND PROPERTY MACOSX_RPATH true)
-if (MSVC)
-set_property(TARGET ${PROGRAM}
- APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO)
+generate_export_header(${LIBRARY}
+ BASE_NAME ${PROJECT_NAME})
+if (MSVC)
+ set_property(TARGET ${PROGRAM}
+ APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO)
endif(MSVC)
install(TARGETS ${PROGRAM} ${LIBRARY}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
-install(DIRECTORY ./
- DESTINATION include/${PROJECT_NAME}
- FILES_MATCHING PATTERN "*.h")
+
+install(FILES cmark.h buffer.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
+ DESTINATION includes/${PROJECT_NAME}
+ )
include (CheckIncludeFile)
CHECK_INCLUDE_FILE (stdbool.h HAVE_STDBOOL_H)
@@ -87,7 +95,7 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif()
elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall -std=c99 -pedantic")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99 -pedantic")
endif()
if($ENV{TIMER})