[LLVMdev] Cmake sample standalone project

Óscar Fuentes ofv at wanadoo.es
Fri Feb 8 13:05:04 PST 2013


Wojciech Daniło <wojtek.danilo.ml at gmail.com> writes:

> When using LLVM there is a folder: llvm/projects/sample which contains a
> file structure aimed at developing own project. It seems it uses autotools.
> Is there anywhere such structure but cmake oriented? So I can use it to
> build my project as standalone project?
>
> I know I can make simple cmakes like in llvm/examples/... directories, but
> then I have to execute cmake from llvm source everytme I want to compile my
> program - I want to create the project as standalone, but I would love to
> use as a starting point good designed and prepared CmakeList.txt's like the
> good prepared autotools project.
>
> Is there any tested sample cmake project out there?

See http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project

>From that code snippet, the only missing thing is putting 

project(myproject)

at the beginning and

add_executable(mycompiler mysource1.cpp mysource2.cpp ...)

in some place before the target_link_libraries. Of course, you may also
need to add your own include paths, libraries, etc.




More information about the llvm-dev mailing list