File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,26 @@ INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/include/jdbc/cppconn")
44
44
set (MY_TARGET_LINK_LIBRARIES connector-jdbc )
45
45
46
46
47
- if (DEFINED GCC AND GCC VERSION_LESS 9 )
47
+ # Note: Some unit tests use std::filesystem part of the standard C++ library
48
+ # and for some versions of the standard library its implementation is in
49
+ # additional library stdc++fs.
48
50
49
- # Note: Some unit tests use std::filesystem part of the standard library
50
- # Before version 9 of gcc that requires linking with the additional library
51
+ if (NOT WIN32 )
51
52
52
- list (APPEND MY_TARGET_LINK_LIBRARIES -lstdc++fs )
53
- # message(STATUS "Added libstdc++fs for GCC version ${GCC}: ${MY_TARGET_LINK_LIBRARIES}")
53
+ set (check_src "${CMAKE_CURRENT_BINARY_DIR} /filesystem_chk.cc" )
54
+ file (WRITE "${check_src} "
55
+ "#include <filesystem>\n "
56
+ "int main() { (void)std::filesystem::current_path(); }"
57
+ )
58
+
59
+ try_compile (COMPILE_RESULT
60
+ ${CMAKE_CURRENT_BINARY_DIR} "${check_src} "
61
+ # OUTPUT_VARIABLE build_log
62
+ )
63
+
64
+ if (NOT COMPILE_RESULT )
65
+ list (APPEND MY_TARGET_LINK_LIBRARIES -lstdc++fs )
66
+ endif ()
54
67
55
68
endif ()
56
69
You can’t perform that action at this time.
0 commit comments