Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Cmake Intro
Cmake Intro
Daniel Molina
Presentación
1 Introducción
2 Ejecutando CMake
3 Ejemplos
Introducción Ejecutando CMake Ejemplos Final
Qué es CMake
CMake:
Genera ficheros de compilación.
Introducción Ejecutando CMake Ejemplos Final
Qué es CMake
CMake:
Genera ficheros de compilación.
Unix/Linux → Makefiles.
Windows → Proyectos Visual Studio.
Apple → Xcode.
Introducción Ejecutando CMake Ejemplos Final
Qué es CMake
CMake:
Genera ficheros de compilación.
Unix/Linux → Makefiles.
Windows → Proyectos Visual Studio.
Apple → Xcode.
Multiplataforma.
Introducción Ejecutando CMake Ejemplos Final
Qué es CMake
CMake:
Genera ficheros de compilación.
Unix/Linux → Makefiles.
Windows → Proyectos Visual Studio.
Apple → Xcode.
Multiplataforma.
Software Libre :-).
Introducción Ejecutando CMake Ejemplos Final
Qué es CMake
CMake:
Genera ficheros de compilación.
Unix/Linux → Makefiles.
Windows → Proyectos Visual Studio.
Apple → Xcode.
Multiplataforma.
Software Libre :-).
Qué es CMake
CMake:
Genera ficheros de compilación.
Unix/Linux → Makefiles.
Windows → Proyectos Visual Studio.
Apple → Xcode.
Multiplataforma.
Software Libre :-).
Qué es CMake
CMake:
Genera ficheros de compilación.
Unix/Linux → Makefiles.
Windows → Proyectos Visual Studio.
Apple → Xcode.
Multiplataforma.
Software Libre :-).
Caracterı́sticas de CMake
Kitware, http://www.kitware.com/
The Visualization ToolKit (VTK), http://www.vtk.org/
ParaView, http://www.paraview.org/
KDE 4, https://lwn.net/Articles/188693/
Introducción Ejecutando CMake Ejemplos Final
Estructura
Ejecutando CMake
Estructura CMakeLists.txt
hello src PROJECT(hello C)
hello.c SET(SRC
CMakeLists.txt hello.c)
Estructura CMakeLists.txt
hello src PROJECT(hello C)
hello.c SET(SRC
CMakeLists.txt hello.c)
Makefile
ADD EXECUTABLE(hello ${SRC})
Introducción Ejecutando CMake Ejemplos Final
Estructura CMakeLists.txt
hello src PROJECT(hello C)
hello.c SET(SRC
CMakeLists.txt hello.c)
Makefile
ADD EXECUTABLE(hello ${SRC})
CMakeFiles
CMakeCache.txt
cmake install.cmake
hello
Introducción Ejecutando CMake Ejemplos Final
Estructura
hello src
hello.c
CMakeLists.txt
Makefile
CMakeFiles
CMakeCache.txt
cmake install.cmake
hello → Ejecutable
Introducción Ejecutando CMake Ejemplos Final
Estructura
hello src
hello.c
CMakeLists.txt
cmake install.cmake
hello → Ejecutable
Introducción Ejecutando CMake Ejemplos Final
Estructura
hello src
hello.c
CMakeLists.txt
cmake install.cmake
hello → Ejecutable
Introducción Ejecutando CMake Ejemplos Final
Estructura
hello src
hello.c
CMakeLists.txt
hello → Ejecutable
Introducción Ejecutando CMake Ejemplos Final
Estructura
hello src
hello.c
CMakeLists.txt
Otra alternativa:
mkdir build
cd build
cmake ..
Ası́, todos los ficheros adicionales están en bin
También se puede hacer configurando adecuadamente
CMakeLists.txt
Introducción Ejecutando CMake Ejemplos Final
Otras versiones
hellolib.c hello.c
#i n c l u d e <s t d i o . h> /∗ h e l l o . c : d i s p l a y a m e s s a g e
#i n c l u d e <s t r i n g . h> on t h e s c r e e n ∗/
#i n c l u d e <s t d i o . h>
v o i d g e t m s g ( c h a r ∗msg ) { #i n c l u d e ” h e l l o l i b . h”
s t r c p y ( msg , ” h e l l o , w o r l d \n ” ) ;
} i n t main ( v o i d ) {
c h a r msg [ 3 0 ] ;
g e t m s g ( msg ) ;
p r i n t f ( msg ) ;
hellolib.h return 0;
}
#i f n d e f HELLO LIB H
#d e f i n e HELLO LIB H 1
v o i d g e t m s g ( c h a r ∗msg ) ;
#e n d i f
Introducción Ejecutando CMake Ejemplos Final
Sin ibrerı́a
PROJECT( h e l l o C)
SET ( SRC
hello
hellolib )
SET ( SRC
hello )