Skip to content

Commit 9f279be

Browse files
authored
Merge pull request commonmark#250 from nwellnhof/test-static-only-build
Test static-only build
2 parents db63ea9 + 9253cbf commit 9f279be

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ language: c
88
compiler:
99
- clang
1010
- gcc
11+
matrix:
12+
include:
13+
- os: linux
14+
compiler: gcc
15+
env: CMAKE_OPTIONS="-DCMARK_SHARED=OFF"
1116
addons:
1217
apt:
1318
# we need a more recent cmake than travis/linux provides (at least 2.8.9):
@@ -26,7 +31,7 @@ before_install:
2631
fi
2732
2833
script:
29-
- make
34+
- (mkdir -p build && cd build && cmake $CMAKE_OPTIONS ..)
3035
- make test
3136
- |
3237
if [ ${TRAVIS_OS_NAME:-'linux'} = 'linux' ]

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ option(CMARK_SHARED "Build shared libcmark library" ON)
2727
option(CMARK_LIB_FUZZER "Build libFuzzer fuzzing harness" OFF)
2828

2929
add_subdirectory(src)
30-
if(CMARK_TESTS AND CMARK_SHARED)
30+
if(CMARK_TESTS AND (CMARK_SHARED OR CMARK_STATIC))
3131
add_subdirectory(api_test)
3232
endif()
3333
add_subdirectory(man)

api_test/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ include_directories(
88
${PROJECT_SOURCE_DIR}/src
99
${PROJECT_BINARY_DIR}/src
1010
)
11-
target_link_libraries(api_test libcmark)
11+
if(CMARK_SHARED)
12+
target_link_libraries(api_test libcmark)
13+
else()
14+
target_link_libraries(api_test libcmark_static)
15+
endif()
1216

1317
# Compiler flags
1418
if(MSVC)

test/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else(SPEC_TESTS)
99
find_package(PythonInterp 3)
1010
endif(SPEC_TESTS)
1111

12-
if (CMARK_SHARED)
12+
if (CMARK_SHARED OR CMARK_STATIC)
1313
add_test(NAME api_test COMMAND api_test)
1414
endif()
1515

@@ -41,14 +41,14 @@ IF (PYTHONINTERP_FOUND)
4141
"--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
4242
)
4343

44-
add_test(roundtriptest_executable
44+
add_test(roundtriptest_library
4545
${PYTHON_EXECUTABLE}
4646
"${CMAKE_CURRENT_SOURCE_DIR}/roundtrip_tests.py"
4747
"--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt"
4848
"--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
4949
)
5050

51-
add_test(entity_executable
51+
add_test(entity_library
5252
${PYTHON_EXECUTABLE}
5353
"${CMAKE_CURRENT_SOURCE_DIR}/entity_tests.py"
5454
"--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"

0 commit comments

Comments
 (0)