cmark

My personal build of CMark ✏️

Commit
c140ea1bc5612233c7ef7063787e3864c08b304a
Parent
2c9f10ab4458af452c353d3ea9c68d86e2e8507e
Author
John MacFarlane <jgm@berkeley.edu>
Date

More cmake cleanup.

Diffstat

2 files changed, 8 insertions, 61 deletions

Status File Name N° Changes Insertions Deletions
Modified CMakeLists.txt 60 0 60
Modified src/CMakeLists.txt 9 8 1
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -16,66 +16,6 @@ add_subdirectory(src)
 
 set(CMAKE_BUILD_TYPE Release)
 
-#option(${PROJECT_NAME}_WITH_DOCS "generate Documentation" OFF)
-#option(${PROJECT_NAME}_WITH_TESTS "enable testing" ON)
-option(CMAKE_SUPPRESS_REGENERATION "suppress rules to re-run cmake on changes (warning: no dependency checks!)?" OFF)
-if (MSVC)
-    set(RE2C ${CMAKE_CURRENT_SOURCE_DIR}/re2c)
-else(MSVC)
-    set(RE2C re2c)
-endif(MSVC)
-
-if (MSVC)
-  option(PROJECT_LINK_MSVC_MT "link with /MT instead of /MD (use msvc runtime dlls versus static linked)" ON)
-  # see http://msdn.microsoft.com/en-us/library/2kzt1wy3%28VS.71%29.aspx
-  if (PROJECT_LINK_MSVC_MT)
-    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
-    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
-    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
-  endif (PROJECT_LINK_MSVC_MT)
-
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO")
-  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4")
-  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4")
-
-  set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS UNICODE)
-    set(CMAKE_FIND_LIBRARY_PREFIXES "")
-    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
-    set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
-    set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
-    set(CMAKE_SHARED_LIBRARY_PREFIX "")          # lib
-    set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")          # .so
-    set(CMAKE_IMPORT_LIBRARY_PREFIX "")
-    set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
-    set(CMAKE_EXECUTABLE_SUFFIX ".exe")          # .exe
-    set(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
-    set(CMAKE_DL_LIBS "")
-    set(CMAKE_DEBUG_POSTFIX "d")
-    add_definitions(-DUNICODE -D_UNICODE)
-else(MSVC)
-  list(APPEND CMAKE_CXX_FLAGS "-Wall -Wunused-variable -Wno-long-long")
-   #-pedantic
-  list(APPEND CMAKE_C_FLAGS "-Wall -Wunused-variable -Wno-long-long")
-endif(MSVC)
-
-# create config.h
-# configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
-#        ${CMAKE_CURRENT_BINARY_DIR}/config.h)
-
-# set include directories
-get_filename_component(CONFIG_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/config.h PATH)
-include_directories(include ${CONFIG_INCLUDE})
-
-install(DIRECTORY include DESTINATION .
-    COMPONENT devel
-    FILES_MATCHING PATTERN "*.h"
-    PATTERN .svn EXCLUDE
-    )
-# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
-#     DESTINATION include/${PROJECT_NAME}
-#     COMPONENT devel)
-
 set(CPACK_GENERATOR TGZ ZIP)
 if(WIN32 AND NOT CYGWIN)
   set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -38,11 +38,13 @@ set(PROGRAM_SOURCES
 include_directories(. html)
 
 if (MSVC)
+    set(RE2C ${CMAKE_CURRENT_SOURCE_DIR}/re2c)
     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)
+    set(RE2C re2c)
     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)
@@ -63,7 +65,11 @@ endif(MSVC)
 
 install(TARGETS ${PROGRAM} ${LIBRARY}
   RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib)
+  LIBRARY DESTINATION lib
+  )
+install(DIRECTORY ./
+  DESTINATION include/${PROJECT_NAME}
+  FILES_MATCHING PATTERN "*.h")
 
 if(UNIX)
   INSTALL(FILES ../man/man1/cmark.1 DESTINATION share/man/man1)
@@ -83,3 +89,4 @@ if(MSVC)
 elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99")
 endif()
+