Domanda

Per i motivi irrilevanti per menzionare, vorrei essere in grado di includere più file nel file toolchain. Diciamo che la mia toolchain contiene seguenti:

message(STATUS "file1 is ok")
include(./build/file2)

Il file2 contiene la riga di identificazione:

message(STATUS "file2 is ok")

i cmakelists.txt contiene:

cmake_minimum_required (VERSION 2.8.8)
project (pro)
message(STATUS "cmakelists.txt is ok")

Lo chiamo usando il comando seguente:

cmake -DCMAKE_TOOLCHAIN_FILE=../../build/file1 ../../

Ora mi aspetterei il seguente output:

-- file1 is ok
-- file2 is ok
-- cmakelists.txt is ok

Eppure capisco questo:

-- file1 is ok
-- file2 is ok
-- file1 is ok
-- file2 is ok
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/bin/cc
CMake Error at /fullpath/build/file1:2 (include):
  include could not find load file:
    ./build/file2
Call Stack (most recent call first):
  /fullpath/build/Mac/CMakeFiles/2.8.12/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:2 (PROJECT)
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.
  It fails with the following output:
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!

Non solo CMake stampare le informazioni due volte, ma sostiene anche che non riesce a trovare file inclusi alla terza volta dopo.

Qualche idea?

È stato utile?

Soluzione

Non solo Cmake stampare le informazioni due volte

È normale: durante la configurazione vengono eseguiti diversi passaggi. Ad ogni passaggio utilizzato il file toolchain.

Afferma inoltre che non può trovare file inclusi in una terza volta. Qualche idea?

Fornire un percorso assoluto.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top