From 3f9db69beef5225a3cf2473564576690a28a5aa9 Mon Sep 17 00:00:00 2001 From: memsharded Date: Thu, 10 Jan 2019 17:56:45 +0100 Subject: [PATCH 1/3] disable cmake compiler check language=None --- conans/client/generators/cmake_common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conans/client/generators/cmake_common.py b/conans/client/generators/cmake_common.py index 1f31b9ced9c..01d58a36bac 100644 --- a/conans/client/generators/cmake_common.py +++ b/conans/client/generators/cmake_common.py @@ -397,6 +397,10 @@ def generate_targets_section(dependencies): endfunction() function(conan_check_compiler) + if(CONAN_DISABLE_CHECK_COMPILER) + conan_message(STATUS "WARN: Disabled conan compiler checks") + return() + endif() if(NOT DEFINED CMAKE_CXX_COMPILER_ID) if(DEFINED CMAKE_C_COMPILER_ID) conan_message(STATUS "This project seems to be plain C, using '${CMAKE_C_COMPILER_ID}' compiler") @@ -406,10 +410,6 @@ def generate_targets_section(dependencies): message(FATAL_ERROR "This project seems to be plain C, but no compiler defined") endif() endif() - if(CONAN_DISABLE_CHECK_COMPILER) - conan_message(STATUS "WARN: Disabled conan compiler checks") - return() - endif() if(NOT CMAKE_CXX_COMPILER_ID AND NOT CMAKE_C_COMPILER_ID) # This use case happens when compiler is not identified by CMake, but the compilers are there and work conan_message(STATUS "*** WARN: CMake was not able to identify a C or C++ compiler ***") From afdf8df14b3ec969e76e05c55db5b619ec3b141a Mon Sep 17 00:00:00 2001 From: memsharded Date: Fri, 11 Jan 2019 01:02:46 +0100 Subject: [PATCH 2/3] added test --- .../test/functional/generators/cmake_test.py | 25 +++++++++++++++++++ .../functional/old/libcxx_setting_test.py | 8 +----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/conans/test/functional/generators/cmake_test.py b/conans/test/functional/generators/cmake_test.py index 7d8c5cfdc43..6d0cdf67eeb 100644 --- a/conans/test/functional/generators/cmake_test.py +++ b/conans/test/functional/generators/cmake_test.py @@ -9,6 +9,31 @@ class CMakeGeneratorTest(unittest.TestCase): + def test_no_check_compiler(self): + # https://github.com/conan-io/conan/issues/4268 + file_content = '''from conans import ConanFile, CMake + +class ConanFileToolsTest(ConanFile): + + def build(self): + cmake = CMake(self) + cmake.configure() + ''' + + cmakelists = '''cmake_minimum_required(VERSION 2.8) +PROJECT(conanzlib LANGUAGES NONE) +set(CONAN_DISABLE_CHECK_COMPILER TRUE) + +include(conanbuildinfo.cmake) +CONAN_BASIC_SETUP() +''' + client = TestClient() + client.save({"conanfile.py": file_content, + "CMakeLists.txt": cmakelists}) + + client.run('install .') + client.run('build .') + @attr('slow') def no_output_test(self): client = TestClient() diff --git a/conans/test/functional/old/libcxx_setting_test.py b/conans/test/functional/old/libcxx_setting_test.py index ed8ebc4a0e2..20f02037920 100644 --- a/conans/test/functional/old/libcxx_setting_test.py +++ b/conans/test/functional/old/libcxx_setting_test.py @@ -39,15 +39,9 @@ def package(self): ''' -def nowintest(func): - if platform.system() == "Windows": - func.__test__ = False - return func - - class LibcxxSettingTest(unittest.TestCase): - @nowintest + @unittest.skipIf(platform.system() == "Windows", "Not in Windows") def test_declared_stdlib_and_passed(self): client = TestClient() client.save({"conanfile.py": file_content, From b0b3d1c590d2f3b09ce63b5f20f9252fdc15b245 Mon Sep 17 00:00:00 2001 From: memsharded Date: Fri, 11 Jan 2019 01:14:31 +0100 Subject: [PATCH 3/3] fixed broken test --- conans/test/functional/generators/cmake_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conans/test/functional/generators/cmake_test.py b/conans/test/functional/generators/cmake_test.py index 6d0cdf67eeb..1e19c5c37ec 100644 --- a/conans/test/functional/generators/cmake_test.py +++ b/conans/test/functional/generators/cmake_test.py @@ -14,6 +14,7 @@ def test_no_check_compiler(self): file_content = '''from conans import ConanFile, CMake class ConanFileToolsTest(ConanFile): + generators = "cmake" def build(self): cmake = CMake(self)