Precursor commit for using fs::filesystem

Fixes macOS compilation and corrects linking
across all platforms
master
Fabian Keßler 6 years ago committed by Fabian Keßler
parent 385a0d61a4
commit 6d1730e53d
  1. 10
      cmake/find/FindFilesystem.cmake
  2. 3
      src/util/CMakeLists.txt
  3. 3
      src/util/Stacktrace.cpp
  4. 6
      src/xoj-preview-extractor/CMakeLists.txt
  5. 4
      test/CMakeLists.txt

@ -191,11 +191,15 @@ if (CXX_FILESYSTEM_HAVE_FS)
}
]] code @ONLY)
# Try to compile a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
#Ubuntu 18.04 packaging bug: the gcc8 api is linked with incompatible gcc9 fs STL
if((NOT (CMAKE_CXX_COMPILER_ID STREQUAL GNU)) OR (CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 9))
# Try to compile a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
else()
set(CXX_FILESYSTEM_NO_LINK_NEEDED FALSE CACHE BOOL "" FORCE)
endif()
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
if (NOT CXX_FILESYSTEM_NO_LINK_NEEDED)
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})
# Add the libstdc++ flag

@ -1,8 +1,9 @@
# Util is pretty small so GLOB_RECURSE is sufficient
unset (util_SOURCES)
file (GLOB_RECURSE util_SOURCES *.cpp)
file (GLOB_RECURSE util_SOURCES *.cpp *.h)
add_library (util STATIC ${util_SOURCES})
add_dependencies(util std::filesystem)
target_link_libraries(util PUBLIC std::filesystem cxx17)
target_compile_features(util PUBLIC ${PROJECT_CXX_FEATURES})
target_include_directories(util PUBLIC

@ -2,11 +2,11 @@
#include <array>
#include <iostream>
#include <climits>
#ifdef _WIN32
#include <Windows.h>
#else
#include <climits>
#include <execinfo.h>
#include <unistd.h>
@ -14,6 +14,7 @@
#ifdef __APPLE__
#include <mach-o/dyld.h>
#include <glib.h>
#endif

@ -1,7 +1,7 @@
## xournalpp-thumbnailer executable ##
if (WIN32)
# Windows does not support the thumbniler like this
# Windows does not support the thumbnailer like this
return ()
endif ()
@ -24,11 +24,15 @@ else()
set(thumbnailer_GTK_LDFLAGS "${GTK_LDFLAGS}")
endif()
add_dependencies(xournalpp-thumbnailer std::filesystem)
target_link_libraries (xournalpp-thumbnailer
${ZLIB_LIBRARIES}
${Glib_LDFLAGS}
${ZIP_LDFLAGS}
${thumbnailer_GTK_LDFLAGS}
std::filesystem
util
)
set (THUMBNAILER_BIN "xournalpp-thumbnailer")

@ -39,7 +39,7 @@ add_executable (test-util $<TARGET_OBJECTS:xournalpp-core> $<TARGET_OBJECTS:xour
${util_sources_SOURCES_RECURSE}
)
add_dependencies (test-util xournalpp-core xournalpp-test-base util)
target_link_libraries (test-util ${xournalpp_LDFLAGS} ${CppUnit_LDFLAGS})
target_link_libraries (test-util ${xournalpp_LDFLAGS} ${CppUnit_LDFLAGS} std::filesystem)
## ------------------------
@ -48,7 +48,7 @@ add_executable (test-loadHandler $<TARGET_OBJECTS:xournalpp-core> $<TARGET_OBJEC
control/LoadHandlerTest.cpp
)
add_dependencies (test-loadHandler xournalpp-core xournalpp-test-base util)
target_link_libraries (test-loadHandler ${xournalpp_LDFLAGS} ${CppUnit_LDFLAGS})
target_link_libraries (test-loadHandler ${xournalpp_LDFLAGS} ${CppUnit_LDFLAGS} std::filesystem)
## CTest ##
add_test (util test-util)

Loading…
Cancel
Save