File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ endif()
1616
1717FetchContent_gflags()
1818# Create a symlink from the gflags source directory to third-party/gflags
19- message (STATUS "gflags source dir: ${gflags_SOURCE_DIR} " )
19+ message (STATUS "Creating a symlink from ${gflags_SOURCE_DIR} to third-party/gflags " )
2020execute_process (
2121 COMMAND ${CMAKE_COMMAND} -E create_symlink "${gflags_SOURCE_DIR} " "${CMAKE_CURRENT_SOURCE_DIR} /gflags"
2222)
Original file line number Diff line number Diff line change 88# Make the content available at configure time so that BUCK can use it.
99include (FetchContent)
1010
11+ # Some third-party libraries need to be materialized in the source tree for
12+ # buck. Unfortunately, FetchContent bakes in generator information in the
13+ # fetched content. Thus, if the generator is changed, it causes build failures.
14+ # So, if the generator has changed, then nuke the content.
15+ function (_refresh_cache_if_necessary DIR)
16+ set (_generator_stamp_file "${DIR} /.executorch_cmake_generator_stamp" )
17+ set (_current_generator "${CMAKE_GENERATOR} " )
18+
19+ if (EXISTS "${_generator_stamp_file} " )
20+ file (READ "${_generator_stamp_file} " _previous_generator)
21+ string (STRIP "${_previous_generator} " _previous_generator)
22+ if (NOT _previous_generator STREQUAL _current_generator)
23+ file (REMOVE_RECURSE ${DIR} )
24+ endif ()
25+ endif ()
26+
27+ file (WRITE "${_generator_stamp_file} " "${_current_generator} " )
28+ endfunction ()
29+
1130function (FetchContent_gflags)
31+ if (NOT ${gflags_SOURCE_DIR} STREQUAL "" )
32+ _refresh_cache_if_necessary(${gflags_SOURCE_DIR} )
33+ endif ()
34+
1235 FetchContent_Declare(
1336 gflags
1437 GIT_REPOSITORY https://github.com/gflags/gflags.git
You can’t perform that action at this time.
0 commit comments