2010-02-15 14 views
6

Diciamo che ho un CMakeLists.txt e voglio chiamare un altro includere un altro makefile in quel file (simile alla sintassi #include in C), come avrei potuto ottenere questo risultato?CMake e tra gli altri makefile

risposta

9

Dal CMake documentation:

  • include: Leggi CMake codice listfile dal file specificato. uso

    include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>] 
            [NO_POLICY_SCOPE]) 
    

Esempio:

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8) 
include (Project.txt) 

project.txt:

project (Project) 
add_executable(Project project.c)