diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-11-06 23:36:49 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-11-06 23:36:49 -0800 |
commit | 423de04c79ec06f0bdfeb0d5087fbb88071a6b92 (patch) | |
tree | d21651f018390568f5b0e6f8dfdc0fabb6cce045 /src | |
parent | 91910b094af8bedb08f612ec3e4036a25a748a0f (diff) | |
parent | bc978561c1616985df6a73657db5015822c4b33b (diff) |
Merge branch 'cmake'
Conflicts:
Makefile
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..f5fe29d --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,61 @@ +set(LIBRARY "commonmark") +set(HEADERS cmark.h + buffer.h + chunk.h + references.h + debug.h + utf8.h + scanners.h + inlines.h + html/html_unescape.h + html/houdini.h + ) +set(LIBRARY_SOURCES blocks.c + inlines.c + print.c + scanners.c + scanners.re + utf8.c + buffer.c + references.c + html/html.c + html/html_unescape.gperf + html/houdini_href_e.c + html/houdini_html_e.c + html/houdini_html_u.c + ${HEADERS} + ) +set(PROGRAM "cmark") +set(PROGRAM_SOURCES ${LIBRARY_SOURCES} + main.c) + +include_directories(. html) + +if (MSVC) + file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} DOS_CURRENT_SOURCE_DIR) + add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/scanners.c + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scanners.re + COMMAND ${RE2C} --case-insensitive -b -i ${DOS_CURRENT_SOURCE_DIR}\\scanners.re >${DOS_CURRENT_SOURCE_DIR}\\scanners.c) +else(MSVC) + add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/scanners.c + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scanners.re + COMMAND ${RE2C} --case-insensitive -b -i ${CMAKE_CURRENT_SOURCE_DIR}/scanners.re >${CMAKE_CURRENT_SOURCE_DIR}/scanners.c) +endif(MSVC) + +add_executable(${PROGRAM} + ${PROGRAM_SOURCES}) + +add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES}) + +set_property(TARGET ${LIBRARY} + APPEND PROPERTY MACOSX_RPATH true) + +if (MSVC) +set_property(TARGET ${PROGRAM} + APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO) +# if sometimes libs are needed ... +#target_link_libraries(${PROGRAM_chronolog}) +endif(MSVC) +install(TARGETS ${PROGRAM} ${LIBRARY} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) |