cmark

My personal build of CMark ✏️

Commit
9f279be995da5f15a9a988fe93dc983401c28d95
Parent
db63ea9a07135568c44d537a9f2e999b210f0b9f
Author
John MacFarlane <jgm@berkeley.edu>
Date

Merge pull request #250 from nwellnhof/test-static-only-build

Test static-only build

Diffstat

4 files changed, 15 insertions, 6 deletions

Status File Name N° Changes Insertions Deletions
Modified .travis.yml 7 6 1
Modified CMakeLists.txt 2 1 1
Modified api_test/CMakeLists.txt 6 5 1
Modified test/CMakeLists.txt 6 3 3
diff --git a/.travis.yml b/.travis.yml
@@ -8,6 +8,11 @@ language: c
 compiler:
  - clang
  - gcc
+matrix:
+  include:
+  - os: linux
+    compiler: gcc
+    env: CMAKE_OPTIONS="-DCMARK_SHARED=OFF"
 addons:
   apt:
     # we need a more recent cmake than travis/linux provides (at least 2.8.9):
@@ -26,7 +31,7 @@ before_install:
      fi
 
 script:
- - make
+ - (mkdir -p build && cd build && cmake $CMAKE_OPTIONS ..)
  - make test
  - |
      if [ ${TRAVIS_OS_NAME:-'linux'} = 'linux' ]
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -27,7 +27,7 @@ option(CMARK_SHARED "Build shared libcmark library" ON)
 option(CMARK_LIB_FUZZER "Build libFuzzer fuzzing harness" OFF)
 
 add_subdirectory(src)
-if(CMARK_TESTS AND CMARK_SHARED)
+if(CMARK_TESTS AND (CMARK_SHARED OR CMARK_STATIC))
   add_subdirectory(api_test)
 endif()
 add_subdirectory(man)
diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt
@@ -8,7 +8,11 @@ include_directories(
   ${PROJECT_SOURCE_DIR}/src
   ${PROJECT_BINARY_DIR}/src
 )
-target_link_libraries(api_test libcmark)
+if(CMARK_SHARED)
+  target_link_libraries(api_test libcmark)
+else()
+  target_link_libraries(api_test libcmark_static)
+endif()
 
 # Compiler flags
 if(MSVC)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
@@ -9,7 +9,7 @@ else(SPEC_TESTS)
   find_package(PythonInterp 3)
 endif(SPEC_TESTS)
 
-if (CMARK_SHARED)
+if (CMARK_SHARED OR CMARK_STATIC)
   add_test(NAME api_test COMMAND api_test)
 endif()
 
@@ -41,14 +41,14 @@ IF (PYTHONINTERP_FOUND)
       "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
       )
 
-    add_test(roundtriptest_executable
+    add_test(roundtriptest_library
       ${PYTHON_EXECUTABLE}
       "${CMAKE_CURRENT_SOURCE_DIR}/roundtrip_tests.py"
       "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt"
       "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
       )
 
-    add_test(entity_executable
+    add_test(entity_library
       ${PYTHON_EXECUTABLE}
       "${CMAKE_CURRENT_SOURCE_DIR}/entity_tests.py"
       "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"