This isn't meant to be a sample, but I can share with you the cmake files I use for my compiler. It builds in both windows user MSVC, and linux using G++, but should work with MinGW. the structure is src/ CMakeLists.txt # root make file front/ CMakeLists.txt # library middle/ CMakeLists.txt # library back/ CMakeLists.txt # library npp/ CMakeLists.txt # executable On Sun, Jun 13, 2010 at 8:00 AM, Óscar Fuentes <ofv at wanadoo.es> wrote:> sam lee <skynare at gmail.com> writes: > > > Hi, > > > > I built LLVM on Windows XP through cmake and MinGW make. That was a > breeze! > > Now, I wanted to start a project. > > It seems like I need Makefile.rules and Makefile.config to start a new > > project (from http://llvm.org/docs/Projects.html). > > Those files are unrelated to cmake. > > > And llvm/projects/sample uses autoconf (or ./configure). Is there cmake > > based sample project available? > > I could not find any from official release. Has any of you written sample > > project template that uses cmake? > > Just make a directory under LLVM_ROOT/projects and put your source > there, with a CMakeLists.txt file that contains the right directives > (you can use any of the llvm tools or libraries under LLVM_ROOT/tools or > LLVM_ROOT/lib as an example.) After creating those files, you must > re-invoke cmake for it taking notice of your new project. > > Another approach is to build and install LLVM and write your project as > an standalone source tree outside LLVM's. Then link the LLVM libraries > into your executable. > > [snip] > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100613/8dc43dd1/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: src.zip Type: application/zip Size: 2486 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100613/8dc43dd1/attachment.zip>
Ah, thank you so much. How did you get the list of target_link_libraries() ? Did you use llvm-config? If you did not have access to llvm-config, how would you get list of libraries to link to? Thanks. Sam On Sun, Jun 13, 2010 at 2:44 PM, Nathan Jeffords <blunted2night at gmail.com>wrote:> This isn't meant to be a sample, but I can share with you the cmake files I > use for my compiler. It builds in both windows user MSVC, and linux using > G++, but should work with MinGW. > > the structure is > > src/ > CMakeLists.txt # root make file > front/ > CMakeLists.txt # library > middle/ > CMakeLists.txt # library > back/ > CMakeLists.txt # library > npp/ > CMakeLists.txt # executable > > > > On Sun, Jun 13, 2010 at 8:00 AM, Óscar Fuentes <ofv at wanadoo.es> wrote: > >> sam lee <skynare at gmail.com> writes: >> >> > Hi, >> > >> > I built LLVM on Windows XP through cmake and MinGW make. That was a >> breeze! >> > Now, I wanted to start a project. >> > It seems like I need Makefile.rules and Makefile.config to start a new >> > project (from http://llvm.org/docs/Projects.html). >> >> Those files are unrelated to cmake. >> >> > And llvm/projects/sample uses autoconf (or ./configure). Is there cmake >> > based sample project available? >> > I could not find any from official release. Has any of you written >> sample >> > project template that uses cmake? >> >> Just make a directory under LLVM_ROOT/projects and put your source >> there, with a CMakeLists.txt file that contains the right directives >> (you can use any of the llvm tools or libraries under LLVM_ROOT/tools or >> LLVM_ROOT/lib as an example.) After creating those files, you must >> re-invoke cmake for it taking notice of your new project. >> >> Another approach is to build and install LLVM and write your project as >> an standalone source tree outside LLVM's. Then link the LLVM libraries >> into your executable. >> >> [snip] >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100613/dfe38672/attachment.html>
I built the list by hand though trial and error. I'm not sure if and how llvm-config works with cmake. Its seems now that I got the right dependencies in the right order, there have been no ongoing maintenance issues. On Sun, Jun 13, 2010 at 4:32 PM, sam lee <skynare at gmail.com> wrote:> Ah, thank you so much. > How did you get the list of target_link_libraries() ? > Did you use llvm-config? > If you did not have access to llvm-config, how would you get list of > libraries to link to? > > Thanks. > Sam > > > > On Sun, Jun 13, 2010 at 2:44 PM, Nathan Jeffords <blunted2night at gmail.com>wrote: > >> This isn't meant to be a sample, but I can share with you the cmake files >> I use for my compiler. It builds in both windows user MSVC, and linux using >> G++, but should work with MinGW. >> >> the structure is >> >> src/ >> CMakeLists.txt # root make file >> front/ >> CMakeLists.txt # library >> middle/ >> CMakeLists.txt # library >> back/ >> CMakeLists.txt # library >> npp/ >> CMakeLists.txt # executable >> >> >> >> On Sun, Jun 13, 2010 at 8:00 AM, Óscar Fuentes <ofv at wanadoo.es> wrote: >> >>> sam lee <skynare at gmail.com> writes: >>> >>> > Hi, >>> > >>> > I built LLVM on Windows XP through cmake and MinGW make. That was a >>> breeze! >>> > Now, I wanted to start a project. >>> > It seems like I need Makefile.rules and Makefile.config to start a new >>> > project (from http://llvm.org/docs/Projects.html). >>> >>> Those files are unrelated to cmake. >>> >>> > And llvm/projects/sample uses autoconf (or ./configure). Is there cmake >>> > based sample project available? >>> > I could not find any from official release. Has any of you written >>> sample >>> > project template that uses cmake? >>> >>> Just make a directory under LLVM_ROOT/projects and put your source >>> there, with a CMakeLists.txt file that contains the right directives >>> (you can use any of the llvm tools or libraries under LLVM_ROOT/tools or >>> LLVM_ROOT/lib as an example.) After creating those files, you must >>> re-invoke cmake for it taking notice of your new project. >>> >>> Another approach is to build and install LLVM and write your project as >>> an standalone source tree outside LLVM's. Then link the LLVM libraries >>> into your executable. >>> >>> [snip] >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100613/74848d45/attachment.html>