Partage
  • Partager sur Facebook
  • Partager sur Twitter

Erreur de build avec CMake

Sujet résolu
    16 juin 2023 à 11:45:37

    Bonjour,  je suis sur Linux et j'essaye de build un programme simple en C++ utilisant Qt avec CMake mais j'ai l'erreur suivante:

    CMake Error: Could not find cmake module file: CMakeDetermine1.0.0Compiler.cmake
    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    Missing variable is:
    CMAKE_1.0.0_COMPILER_ENV_VAR
    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    Missing variable is:
    CMAKE_1.0.0_COMPILER
    CMake Error: Could not find cmake module file: /home/nomdutilisateur/Documents/monprojet/build/CMakeFiles/3.26.4/CMake1.0.0Compiler.cmake
    -- The CXX compiler identification is GNU 13.1.1
    CMake Error at CMakeLists.txt:3 (project):
      No CMAKE_1.0.0_COMPILER could be found.
     
      Tell CMake where to find the compiler by setting the CMake cache entry
      CMAKE_1.0.0_COMPILER to the full path to the compiler, or to the compiler
      name if it is in the PATH.
     
     
    CMake Error: Could not find cmake module file: CMake1.0.0Information.cmake
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    CMake Error: CMAKE_1.0.0_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!

    Pourtant, mon compilateur (gcc) est bel et bien installé.  Voilà le contenu du fichier CMakeLists.txt au cas où:

    cmake_minimum_required(VERSION 3.1.0)
     
    project(helloworld 1.0.0 LANGUAGES CXX)
     
    set(CMAKE_CXX_STANDARD 11)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
     
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    set(CMAKE_AUTOUIC ON)
     
    if(CMAKE_VERSION VERSION_LESS "3.7.0")
        set(CMAKE_INCLUDE_CURRENT_DIR ON)
    endif()
     
    find_package(Qt5 COMPONENTS Widgets REQUIRED)
     
    if(Qt5Widgets_FOUND)
        message("Qt5 not found")
    endif()
     
    add_executable(helloworld
        ui/mainwindow.ui
        src/mainwindow.cpp
        main.cpp
    )
     
    target_link_libraries(helloworld Qt5::Widgets)

    Merci d'avance pour votre réponse.

    EDIT: j'avais oublié de mettre le mot-clé VERSION avant 1.0.0 dans l'instruction project().

    -
    Edité par SniffierPond 17 juin 2023 à 10:28:31

    • Partager sur Facebook
    • Partager sur Twitter
      16 juin 2023 à 12:22:09

      Salut !

      Tu as aussi installé g++, en plus de gcc ?

      • Partager sur Facebook
      • Partager sur Twitter

      Si vous ne trouvez plus rien, cherchez autre chose.

        16 juin 2023 à 22:25:23

        Il me semble qu'il a été installé avec le package gcc, en tout cas la commande g++ -v fonctionne.
        • Partager sur Facebook
        • Partager sur Twitter
          17 juin 2023 à 2:14:50

          Ton instruction project() est incorrecte. Si tu veux indiquer la version, il faut ajouter le mot clé VERSION avant 1.0.0
          • Partager sur Facebook
          • Partager sur Twitter
            17 juin 2023 à 10:27:30

            Merci beaucoup, le problème est résolu. Comme quoi c'est les fautes les plus bêtes qui sont les plus embêtantes.
            • Partager sur Facebook
            • Partager sur Twitter

            Erreur de build avec CMake

            × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
            × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
            • Editeur
            • Markdown