aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-24 00:16:39 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-24 00:16:39 +0300
commit3c32508762c764734f08e10abf85ec8017fe578d (patch)
tree3c470329bdfeb3c3bca32e84e735141ddf027cce
parentproject.cmake: set CMAKE_BUILD_PARALLEL_LEVEL (diff)
downloadcmake-common-3c32508762c764734f08e10abf85ec8017fe578d.tar.gz
cmake-common-3c32508762c764734f08e10abf85ec8017fe578d.zip
project.cmake: fix "auto" platform detection
-rw-r--r--project/cmake/toolchain.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/project/cmake/toolchain.py b/project/cmake/toolchain.py
index af3da21..c12ee84 100644
--- a/project/cmake/toolchain.py
+++ b/project/cmake/toolchain.py
@@ -11,6 +11,7 @@ import shutil
import project.mingw
from project.os import on_windows
+from project.platform import Platform
from project.toolchain import ToolchainType
@@ -26,20 +27,19 @@ class Toolchain(abc.ABC):
@staticmethod
def detect(hint, platform, build_dir):
if hint is ToolchainType.AUTO:
- # If the platform wasn't specified, auto-detect everything.
- # There's no need to set -mXX flags, etc.
- if platform is None:
- return Auto()
- # If a specific platform was requested, we might need to set some
- # CMake/compiler flags.
if on_windows():
- # We need to specify the -A parameter. This might break if
- # none of the Visual Studio generators are available, but the
- # NMake one is, although I don't know how this can be possible
- # normally.
+ # On Windows, 'auto' means 'msvc', and we need to specify the
+ # -A parameter. This might break if none of the Visual Studio
+ # generators are available, but the NMake one is, although I
+ # don't know how this can be possible normally.
hint = ToolchainType.MSVC
else:
- # Same thing for the -m32/-m64 flags.
+ # On Linux, if the platform wasn't specified, auto-detect
+ # everything. There's no need to set -mXX flags, etc.
+ if platform is Platform.AUTO:
+ return Auto()
+ # If a specific platform was requested, we might need to set
+ # some CMake/compiler flags, like -m32/-m64.
hint = ToolchainType.GCC
if hint is ToolchainType.MSVC:
return MSVC(platform)