On mardi 19 novembre 2019 11:06:38 CET Christophe Giboudeaux wrote:
> 
> And a last patch with Bernhard's change and another one to fix build on
> FreeBSD.
> 
(cleaned version now)

Tested successfully locally (openSUSE) with CMake 3.15, ninja 1.9.0 and Tobias 
tested on BSD.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 191fc938..7e84f5fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@ include(KDEFrameworkCompilerSettings)
 include(ECMAddAppIcon)
 include(GenerateExportHeader)
 
-include(thirdparty/CMakeLists.txt)
+add_subdirectory(thirdparty)
 
 if(NOT WIN32)
     set_package_properties(LibSpectre PROPERTIES DESCRIPTION "A PostScript rendering library"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ecc0963d..3c26c4c6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -101,9 +101,9 @@ target_link_libraries(cantorpart KF5::Parts KF5::NewStuff
                      KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets
                      Qt5::PrintSupport cantorlibs cantor_config )
 
-if(Discount_FOUND)
+# if(Discount_FOUND)
     target_link_libraries(cantorpart Discount::Lib)
-endif(Discount_FOUND)
+# endif(Discount_FOUND)
 
 if(BUILD_TESTING)
   add_subdirectory(test)
diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt
index 2cc921b2..46ac27ce 100644
--- a/thirdparty/CMakeLists.txt
+++ b/thirdparty/CMakeLists.txt
@@ -7,19 +7,20 @@ set (DISCOUNT_ONLY_LIBRARY ON)
 set (DISCOUNT_MAKE_INSTALL OFF)
 ExternalProject_Add(
     discount_project
-    URL ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/discount-2.2.6-patched.tar
+    URL ${CMAKE_CURRENT_SOURCE_DIR}/discount-2.2.6-patched.tar
     SOURCE_SUBDIR cmake
     CMAKE_ARGS DISCOUNT_ONLY_LIBRARY DISCOUNT_MAKE_INSTALL
     CMAKE_CACHE_ARGS "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true"
-    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/thirdparty
-    STEP_TARGETS configure build
-    EXCLUDE_FROM_ALL TRUE
+    PREFIX ${CMAKE_CURRENT_BINARY_DIR}
+    INSTALL_COMMAND ""
+    BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/discount_project-build
+    BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/discount_project-build/libmarkdown${CMAKE_STATIC_LIBRARY_SUFFIX}
 )
 
 ExternalProject_Get_Property(discount_project source_dir)
 ExternalProject_Get_Property(discount_project binary_dir)
 
-add_library(Discount::Lib STATIC IMPORTED)
+add_library(Discount::Lib STATIC IMPORTED GLOBAL)
 set_target_properties(Discount::Lib PROPERTIES
     INTERFACE_INCLUDE_DIRECTORIES ${source_dir}
     IMPORTED_LOCATION ${binary_dir}/libmarkdown${CMAKE_STATIC_LIBRARY_SUFFIX}
@@ -29,4 +30,4 @@ add_dependencies(Discount::Lib discount_project-build)
 set(Discount_FOUND TRUE)
 
 # preview.sty
-install(FILES thirdparty/standalone.cls DESTINATION  ${KDE_INSTALL_DATADIR}/cantor/latex )
+install(FILES standalone.cls DESTINATION  ${KDE_INSTALL_DATADIR}/cantor/latex )

Reply via email to