Skip to content

Commit

Permalink
added ifs for MINGW compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
rath3t committed Jun 18, 2021
1 parent a5fbee5 commit f35f371
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 11 additions & 3 deletions source/matplot/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
if(NOT MINGW)
find_package(Filesystem REQUIRED COMPONENTS Experimental Final)
endif()

#######################################################
### Library ###
Expand Down Expand Up @@ -97,8 +99,13 @@ target_include_directories(matplot
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

# Dependencies
if(NOT MINGW)
target_link_libraries_system(matplot
PRIVATE cimg nodesoup std::filesystem)
else()
target_link_libraries_system(matplot
PRIVATE cimg nodesoup)
endif()

# Required compiler features required
# https://cmake.org/cmake/help/v3.14/manual/cmake-compile-features.7.html#requiring-language-standards
Expand All @@ -122,10 +129,11 @@ maybe_target_pedantic_warnings(matplot)
### Definitions ###
#######################################################
# Use experimental filesystem if std::filesystem is not available yet
if (CXX_FILESYSTEM_IS_EXPERIMENTAL)
target_compile_definitions(matplot PRIVATE CXX_FILESYSTEM_IS_EXPERIMENTAL)
if(NOT MINGW)
if (CXX_FILESYSTEM_IS_EXPERIMENTAL)
target_compile_definitions(matplot PRIVATE CXX_FILESYSTEM_IS_EXPERIMENTAL)
endif()
endif()

# Some hack to not depend on FILE* internals
# /~https://github.com/alandefreitas/matplotplusplus/issues/4
include(CheckSymbolExists)
Expand Down
4 changes: 4 additions & 0 deletions test/generate_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
if(NOT MINGW)
find_package(Filesystem REQUIRED)
endif()
add_executable(generate_examples main.cpp)
if(NOT MINGW)
target_link_libraries(generate_examples std::filesystem)
endif()
target_compile_features(generate_examples PRIVATE cxx_std_17)

0 comments on commit f35f371

Please sign in to comment.