Skip to content

Commit 7ba0a62

Browse files
authored
Cleanup search for Git and Python in CMake (#3185)
1 parent 14965f5 commit 7ba0a62

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

CMakeLists.txt

+4-41
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,9 @@ else()
2121
set(SEMVER_PRERELEASE_ID "-${RELEASE_TYPE}")
2222
endif()
2323

24-
if(CMAKE_HOST_WIN32)
25-
# Find python by ourselves, since on windows the find_package lookup
26-
# seems to fail
27-
set(Python_EXECUTABLE "$ENV{DBT_TOOLCHAIN_ROOT}/python/python.exe")
28-
IF(EXISTS ${Python_EXECUTABLE})
29-
execute_process(
30-
COMMAND ${Python_EXECUTABLE} -c "import platform; print(platform.python_version())"
31-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
32-
OUTPUT_VARIABLE Python_VERSION
33-
RESULT_VARIABLE Python_RESULT
34-
OUTPUT_STRIP_TRAILING_WHITESPACE
35-
)
36-
if(NOT ${Python_RESULT} AND NOT ${Python_VERSION} STREQUAL "")
37-
set(Python_Interpreter_FOUND 1)
38-
else()
39-
message(FATAL_ERROR "Python found at ${Python_EXECUTABLE} but failed to get version number")
40-
endif()
41-
else()
42-
set(Python_Interpreter_FOUND 0)
43-
endif()
44-
else()
45-
find_package(Python COMPONENTS Interpreter)
46-
endif()
47-
48-
if (Python_Interpreter_FOUND)
49-
message(VERBOSE "python found: ${Python_EXECUTABLE} version ${Python_VERSION}")
50-
else()
51-
message(FATAL_ERROR "Python not found")
52-
endif(Python_Interpreter_FOUND)
53-
54-
find_package(Git)
55-
56-
if(GIT_FOUND)
57-
message(VERBOSE "git found: ${GIT_EXECUTABLE} version ${GIT_VERSION_STRING}")
58-
else()
59-
message(FATAL_ERROR "Git not found. Check your path.")
60-
endif(GIT_FOUND)
24+
set(Python_ROOT $ENV{DBT_TOOLCHAIN_ROOT}/python CACHE STRING "Path to the Python installation")
25+
find_package(Python REQUIRED COMPONENTS Interpreter)
26+
find_package(Git REQUIRED)
6127

6228
# Get the result of "git rev-parse --short HEAD"
6329
execute_process(
@@ -147,7 +113,6 @@ if(DOXYGEN_FOUND)
147113

148114
# set(DOXYGEN_CLANG_ASSISTED_PARSING YES)
149115
# SET(DOXYGEN_CLANG_DATABASE_PATH build)
150-
151116
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)
152117

153118
file(GLOB markdown_SOURCES *.md)
@@ -196,8 +161,6 @@ add_compile_options(
196161
# ASM stuff
197162
$<$<COMPILE_LANGUAGE:ASM>:-x>
198163
$<$<COMPILE_LANGUAGE:ASM>:assembler-with-cpp>
199-
200-
201164
)
202165

203166
# Add libraries
@@ -229,6 +192,7 @@ list(APPEND DELUGE_COMMON_COMPILE_OPTIONS
229192
$<$<CONFIG:DEBUG>:-Wno-unused-parameter>
230193

231194
$<$<CONFIG:DEBUG>:-Werror=write-strings>
195+
232196
# Offsetof for non standard types is supported in GCC,
233197
# if another compiler does not support it they are obligated to error
234198

@@ -269,7 +233,6 @@ target_link_options(deluge PUBLIC
269233

270234
# Enabled to generate a full ELF, objcopy will do the stripping
271235
# $<$<CONFIG:RELEASE>:LINKER:--strip-all> # Strip
272-
273236
-nostartfiles # Don't emit startfiles
274237

275238
# Print details

0 commit comments

Comments
 (0)