File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,9 @@ CMakeFiles
4545# Ignore compile database
4646# ==============================================================================#
4747compile_commands.json
48+
49+ # Ignore generated GYB files until we fix the workaround on Windows
50+ # ==============================================================================#
51+ 8
52+ 4
53+ SortedCFDatabase.def
Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ function(add_custom_command_target dependency_out_var_name)
123123 # CMake doesn't allow '/' characters in filenames, so replace them with '-'
124124 list (GET ACCT_OUTPUT 0 output_filename)
125125 string (REPLACE "${CMAKE_BINARY_DIR} /" "" target_name "${output_filename} " )
126+ string (REPLACE "${CMAKE_SOURCE_DIR} /" "" target_name "${target_name} " )
126127 string (REPLACE "${CMAKE_CFG_INTDIR} /" "" target_name "${target_name} " )
127128 string (REPLACE "/" "-" target_name "${target_name} " )
128129 else ()
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ function(handle_gyb_source_single dependency_out_var_name)
5151 COMMAND
5252 "${CMAKE_COMMAND} " -E make_directory "${dir} "
5353 COMMAND
54- "${gyb_tool} " "${gyb_flags} "
54+ "${PYTHON_EXECUTABLE} " " ${ gyb_tool} " "${gyb_flags} "
5555 -o "${GYB_SINGLE_OUTPUT} .tmp" "${GYB_SINGLE_SOURCE} "
5656 COMMAND
5757 "${CMAKE_COMMAND} " -E copy_if_different
@@ -113,10 +113,20 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
113113 if (src STREQUAL src_sans_gyb)
114114 list (APPEND de_gybbed_sources "${src} " )
115115 else ()
116+
117+ # On Windows (using Visual Studio), the generated project files assume that the
118+ # generated GYB files will be in the source, not binary directory.
119+ # We can work around this by modifying the root directory when generating VS projects.
120+ if ("${CMAKE_GENERATOR_PLATFORM} " MATCHES "Visual Studio" )
121+ set (dir_root ${CMAKE_CURRENT_SOURCE_DIR} )
122+ else ()
123+ set (dir_root ${CMAKE_CURRENT_BINARY_DIR} )
124+ endif ()
125+
116126 if (arch)
117- set (dir "${CMAKE_CURRENT_BINARY_DIR } /${ptr_size} " )
127+ set (dir "${dir_root } /${ptr_size} " )
118128 else ()
119- set (dir "${CMAKE_CURRENT_BINARY_DIR } " )
129+ set (dir "${dir_root } " )
120130 endif ()
121131 set (output_file_name "${dir} /${src_sans_gyb} " )
122132 list (APPEND de_gybbed_sources "${output_file_name} " )
You can’t perform that action at this time.
0 commit comments