cmark

My personal build of CMark ✏️

Commit
82ea9598bf55320d1161d8ec672c2ac678e2d0f4
Parent
f8271ed0f523f61dae39b2c9edcda7758af2b84d
Author
John MacFarlane <jgm@berkeley.edu>
Date

Merge pull request #126 from nwellnhof/mingw-tests

Fix tests under MinGW

Diffstat

2 files changed, 13 insertions, 10 deletions

Status File Name N° Changes Insertions Deletions
Modified test/CMakeLists.txt 6 3 3
Modified test/cmark.py 17 10 7
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
@@ -13,9 +13,9 @@ add_test(NAME api_test COMMAND api_test)
 
 if (WIN32)
   file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/src WIN_DLL_DIR)
-  set_tests_properties(api_test PROPERTIES
-    ENVIRONMENT "PATH=${WIN_DLL_DIR};$ENV{PATH}"
-    )
+  set(NEWPATH "${WIN_DLL_DIR};$ENV{PATH}")
+  string(REPLACE ";" "\\;" NEWPATH "${NEWPATH}")
+  set_tests_properties(api_test PROPERTIES ENVIRONMENT "PATH=${NEWPATH}")
   set(ROUNDTRIP,"${CMAKE_CURRENT_SOURCE_DIR}/roundtrip.bat")
 else(WIN32)
   set(ROUNDTRIP,"${CMAKE_CURRENT_SOURCE_DIR}/roundtrip.sh")
diff --git a/test/cmark.py b/test/cmark.py
@@ -24,15 +24,18 @@ class CMark:
         else:
             sysname = platform.system()
             if sysname == 'Darwin':
-                libname = "libcmark.dylib"
+                libnames = [ "libcmark.dylib" ]
             elif sysname == 'Windows':
-                libname = "cmark.dll"
+                libnames = [ "cmark.dll", "libcmark.dll" ]
             else:
-                libname = "libcmark.so"
-            if library_dir:
-                libpath = os.path.join(library_dir, libname)
-            else:
-                libpath = os.path.join("build", "src", libname)
+                libnames = [ "libcmark.so" ]
+            if not library_dir:
+                library_dir = os.path.join("build", "src")
+            for libname in libnames:
+                candidate = os.path.join(library_dir, libname)
+                if os.path.isfile(candidate):
+                    libpath = candidate
+                    break
             cmark = CDLL(libpath)
             markdown = cmark.cmark_markdown_to_html
             markdown.restype = c_char_p