Skip to content

Commit

Permalink
Merge pull request #2086 from randomascii/compiler_detect
Browse files Browse the repository at this point in the history
Detect whether VC++ compiler can be found in configure.py
  • Loading branch information
jhasse authored Oct 23, 2022
2 parents d216823 + 69fb2ce commit 023d8a8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,18 @@ def binary(name):
else:
n.variable('ar', configure_env.get('AR', 'ar'))

def search_system_path(file_name):
"""Find a file in the system path."""
for dir in os.environ['path'].split(';'):
path = os.path.join(dir, file_name)
if os.path.exists(path):
return path

# Note that build settings are separately specified in CMakeLists.txt and
# these lists should be kept in sync.
if platform.is_msvc():
if not search_system_path('cl.exe'):
raise Exception('cl.exe not found. Run again from the Developer Command Prompt for VS')
cflags = ['/showIncludes',
'/nologo', # Don't print startup banner.
'/Zi', # Create pdb with debug info.
Expand Down

0 comments on commit 023d8a8

Please sign in to comment.