Commit ddc53574 authored by Andreas Schuh's avatar Andreas Schuh

Add link dependency on shlwapi.lib during build configuration instead of #pragma…

Add link dependency on shlwapi.lib during build configuration instead of #pragma comment statement. Use this library also on MinGW.
parent 9242578b
......@@ -91,7 +91,7 @@ else ()
check_include_file_cxx ("${fname}.h" HAVE_${FNAME}_H)
endif ()
endforeach ()
# the following are used in #if not #ifdef
# the following are used in #if directives not #ifdef
bool_to_int (HAVE_STDINT_H)
bool_to_int (HAVE_SYS_TYPES_H)
bool_to_int (HAVE_INTTYPES_H)
......@@ -219,11 +219,17 @@ include_directories ("${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}")
set (LIB_TARGETS)
if (BUILD_gflags_LIB)
add_library (gflags ${GFLAGS_SRCS} ${PRIVATE_HDRS} ${PUBLIC_HDRS})
if (HAVE_SHLWAPI_H)
target_link_libraries (gflags shlwapi.lib)
endif ()
list (APPEND LIB_TARGETS gflags)
endif ()
if (BUILD_gflags_nothreads_LIB)
add_library (gflags_nothreads ${GFLAGS_SRCS} ${PRIVATE_HDRS} ${PUBLIC_HDRS})
set_target_properties (gflags_nothreads PROPERTIES COMPILE_DEFINITIONS NO_THREADS)
if (HAVE_SHLWAPI_H)
target_link_libraries (gflags_nothreads shlwapi.lib)
endif ()
list (APPEND LIB_TARGETS gflags_nothreads)
endif ()
......
......@@ -95,9 +95,8 @@
#include <errno.h>
#if defined(HAVE_FNMATCH_H)
# include <fnmatch.h>
#elif defined(_MSC_VER) && defined(HAVE_SHLWAPI_H)
#elif defined(HAVE_SHLWAPI_H)
# include <shlwapi.h>
# pragma comment(lib, "shlwapi.lib")
#endif
#include <stdarg.h> // For va_list and related operations
#include <stdio.h>
......@@ -1310,7 +1309,7 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
#if defined(HAVE_FNMATCH_H)
|| fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0
|| fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0
#elif defined(_MSC_VER) && defined(HAVE_SHLWAPI_H)
#elif defined(HAVE_SHLWAPI_H)
|| PathMatchSpec(glob.c_str(), ProgramInvocationName())
|| PathMatchSpec(glob.c_str(), ProgramInvocationShortName())
#endif
......
......@@ -408,7 +408,7 @@ TEST(FlagFileTest, FilenamesOurfileFirst) {
-1.0);
}
#if defined(HAVE_FNMATCH_H) || (defined(_MSC_VER) && defined(HAVE_SHLWAPI_H)) // otherwise glob isn't supported
#if defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) // otherwise glob isn't supported
TEST(FlagFileTest, FilenamesOurfileGlob) {
FLAGS_test_string = "initial";
FLAGS_test_bool = false;
......@@ -460,7 +460,7 @@ TEST(FlagFileTest, FilenamesOurfileInBigList) {
1,
-1.0);
}
#endif // defined(HAVE_FNMATCH_H) || (defined(_MSC_VER) && defined(HAVE_SHLWAPI_H))
#endif // defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H)
// Tests that a failed flag-from-string read keeps flags at default values
TEST(FlagFileTest, FailReadFlagsFromString) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment