From f1d8aaf9bd9c8f6e8a0907422a34c023d527f13f Mon Sep 17 00:00:00 2001
From: Egor Tensin <Egor.Tensin@gmail.com>
Date: Thu, 25 Mar 2021 00:19:26 +0300
Subject: project.cmake.build: -H must be at the end

Older CMake versions don't like it when it's not the last argument.
---
 project/cmake/build.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'project/cmake')

diff --git a/project/cmake/build.py b/project/cmake/build.py
index 20c823f..cb2e4cb 100644
--- a/project/cmake/build.py
+++ b/project/cmake/build.py
@@ -77,6 +77,8 @@ class GenerationPhase:
         result += self.configuration.cmake_args()
         result += self._cmake_boost_args()
         result += self.cmake_args
+        # Important! -H must come as the last parameter, older CMake versions
+        # don't like it when it's not.
         result += self._cmake_dir_args()
         return result
 
@@ -92,12 +94,15 @@ class GenerationPhase:
         ]
 
     def _cmake_dir_args(self):
-        args = [
+        args = []
+        if self.install_dir is not None:
+            args += ['-D', f'CMAKE_INSTALL_PREFIX={self.install_dir}']
+        # Important! -H must come as the last parameter, older CMake versions
+        # don't like it when it's not.
+        args += [
             f'-B{self.build_dir}',
             f'-H{self.src_dir}'
         ]
-        if self.install_dir is not None:
-            args += ['-D', f'CMAKE_INSTALL_PREFIX={self.install_dir}']
         return args
 
     def run(self, toolchain):
-- 
cgit v1.2.3