Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sc1f committed Jan 15, 2021
1 parent 8e0c708 commit 40d8738
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions cmake/modules/FindFlatbuffers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,29 @@
# this might fail
# https://gitlab.kitware.com/cmake/cmake/issues/19120

find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers/flatbuffers.h
PATHS ${FLATBUFFERS_ROOT}/include
HINTS /usr/local /usr/local/flatbuffers /usr/local/Homebrew /usr ~/homebrew/ /usr/local/include /usr/local/flatbuffers/include /usr/include ~/homebrew/include
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH)

find_program(FLATBUFFERS_COMPILER flatc
PATHS ${FLATBUFFERS_ROOT}/bin
HINTS /usr/local/bin /usr/bin /usr/local/Homebrew/bin ~/homebrew/bin
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH)
# TODO: unhack this

if (WIN32)
find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers/flatbuffers.h
PATHS ${FLATBUFFERS_ROOT}/include
HINTS /usr/local /usr/local/flatbuffers /usr/local/Homebrew /usr ~/homebrew/ /usr/local/include /usr/local/flatbuffers/include /usr/include ~/homebrew/include)

find_program(FLATBUFFERS_COMPILER flatc
PATHS ${FLATBUFFERS_ROOT}/bin
HINTS /usr/local/bin /usr/bin /usr/local/Homebrew/bin ~/homebrew/bin)
else()
find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers/flatbuffers.h
PATHS ${FLATBUFFERS_ROOT}/include
HINTS /usr/local /usr/local/flatbuffers /usr/local/Homebrew /usr ~/homebrew/ /usr/local/include /usr/local/flatbuffers/include /usr/include ~/homebrew/include
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH)

find_program(FLATBUFFERS_COMPILER flatc
PATHS ${FLATBUFFERS_ROOT}/bin
HINTS /usr/local/bin /usr/bin /usr/local/Homebrew/bin ~/homebrew/bin
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH)
endif()

if(NOT ${FLATBUFFERS_INCLUDE_DIR})
# HACK
Expand All @@ -45,5 +57,10 @@ endif()

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(FLATBUFFERS REQUIRED_VARS
FLATBUFFERS_INCLUDE_DIR FLATBUFFERS_COMPILER)
if (WIN32)
find_package_handle_standard_args(Flatbuffers REQUIRED_VARS
FLATBUFFERS_INCLUDE_DIR FLATBUFFERS_COMPILER)
else()
find_package_handle_standard_args(FLATBUFFERS REQUIRED_VARS
FLATBUFFERS_INCLUDE_DIR FLATBUFFERS_COMPILER)
endif()

0 comments on commit 40d8738

Please sign in to comment.