Skip to content

Commit

Permalink
Define GFLAGS_IS_A_DLL by target
Browse files Browse the repository at this point in the history
  • Loading branch information
kou authored and wesm committed Feb 19, 2019
1 parent 0f43fc9 commit 2caf588
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 8 additions & 1 deletion cpp/cmake_modules/FindGFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ if(GFLAGS_FOUND)
"${GFLAGS_SHARED_LIB}"
INCLUDE_DIRECTORIES
"${GFLAGS_INCLUDE_DIR}")
target_compile_definitions(gflags_shared INTERFACE "GFLAGS_IS_A_DLL=1")
set(GFLAGS_STATIC_LIB FLASE)
return()
else()
Expand Down Expand Up @@ -111,7 +112,7 @@ if(GFLAGS_INCLUDE_DIR)
else()
set(GFLAGS_STATIC FALSE)
endif()
if(GFLAGS_SHARED AND GFLAGS_STATIC)
if(GFLAGS_SHARED OR GFLAGS_STATIC)
set(GFLAGS_FOUND TRUE)
if(MSVC)
set(GFLAGS_MSVC_DEPS "shlwapi.lib")
Expand All @@ -125,6 +126,12 @@ if(GFLAGS_INCLUDE_DIR)
"${GFLAGS_INCLUDE_DIR}"
DEPS
"${GFLAGS_MSVC_DEPS}")
if(GFLAGS_SHARED)
target_compile_definitions(gflags_shared INTERFACE "GFLAGS_IS_A_DLL=1")
endif()
if(GFLAGS_STATIC)
target_compile_definitions(gflags_static INTERFACE "GFLAGS_IS_A_DLL=0")
endif()
else()
set(GFLAGS_FOUND FALSE)
endif()
Expand Down
1 change: 1 addition & 0 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ if(ARROW_NEED_GFLAGS)
ADD_THIRDPARTY_LIB(gflags
STATIC_LIB ${GFLAGS_STATIC_LIB})
set(GFLAGS_LIBRARY gflags_static)
target_compile_definitions(${GFLAGS_LIBRARY} INTERFACE "GFLAGS_IS_A_DLL=0")
if(MSVC)
set_target_properties(${GFLAGS_LIBRARY}
PROPERTIES
Expand Down
5 changes: 0 additions & 5 deletions cpp/src/arrow/ipc/json-integration-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
// specific language governing permissions and limitations
// under the License.

// ARROW-3837: Depending on how gflags was built, this might be set to
// 1 or 0 by default, making it so that we cannot statically link
// gflags on Windows if it is set to 1
#define GFLAGS_IS_A_DLL 0

#include <cstdint>
#include <cstdio>
#include <cstring>
Expand Down

0 comments on commit 2caf588

Please sign in to comment.