Help with creating CMakeLists.txt

667 views
Skip to first unread message

Wakil Sarfaraz

unread,
Dec 13, 2015, 1:29:11 PM12/13/15
to deal.II User Group
Dear all,

If I would like to write my own dealii code from scratch at some location for example
at the directory of examples, How do I create a CMakeLists.txt in order to execute it using cmake?

Regards,

Wakil,



Jean-Paul Pelteret

unread,
Dec 13, 2015, 1:35:32 PM12/13/15
to deal.II User Group
In the documentation is a guide as to setup cmake for an external project.

Uwe Köcher

unread,
Dec 13, 2015, 1:44:32 PM12/13/15
to deal.II User Group
You can use any of the CMakeLists.txt from the step tutorials as starting point, but you need to set
the enviroment variable
export DEAL_II_DIR=/path/to/your/deal.II
in your terminal.

Wakil Sarfaraz

unread,
Dec 14, 2015, 9:52:37 AM12/14/15
to deal.II User Group
Hello Uwe,
Thanks for the suggestion, Could you please also tell me the step by which I can set the environment variable using the above export command?
I mean should I add this line? 
Regards,
Wakil,

Uwe Köcher

unread,
Dec 14, 2015, 11:57:46 AM12/14/15
to deal.II User Group
you put this into your terminal/konsole before running cmake .

Wakil Sarfaraz

unread,
Dec 14, 2015, 12:19:18 PM12/14/15
to dea...@googlegroups.com
I set the environment variable and when I 'cmake' again, these are the errors I get.

Any suggestions anyone please?

bash-3.2$ cmake .

CMake Warning (dev) at /applications/deal.II.app/Contents/Resources/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake:48 (ADD_EXECUTABLE):

  Policy CMP0037 is not set: Target names should not be reserved and should

  match a validity pattern.  Run "cmake --help-policy CMP0037" for policy

  details.  Use the cmake_policy command to set the policy and suppress this

  warning.


  The target name "“myexample1”" is reserved or not valid for certain

  CMake features, such as generator expressions, and may result in undefined

  behavior.

Call Stack (most recent call first):

  CMakeLists.txt:39 (DEAL_II_INVOKE_AUTOPILOT)

This warning is for project developers.  Use -Wno-dev to suppress it.


-- Autopilot invoked

-- Run   $ make info  to print a detailed help message

-- Configuring done

CMake Error at /applications/deal.II.app/Contents/Resources/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake:48 (ADD_EXECUTABLE):

  Cannot find source file:


    “myexample1”.cc


  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp

  .hxx .in .txx

Call Stack (most recent call first):

  CMakeLists.txt:39 (DEAL_II_INVOKE_AUTOPILOT)



CMake Error: CMake can not determine linker language for target: “myexample1”

CMake Error: Cannot determine link language for target "“myexample1”".

-- Generating done

-- Build files have been written to: /applications/deal.II.app/Contents/Resources/examples/myexample1


--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/R_DsJ6hnMlw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Arndt

unread,
Dec 15, 2015, 5:54:46 AM12/15/15
to deal.II User Group
Wakil,

It seems that you put quotation marks around you target and your source file. Try without them, i.e.
“myexample1” instead of "“myexample1”"
How exactly does your CMakeLists.txt?

Best regards,
Daniel

Wakil Sarfaraz

unread,
Dec 15, 2015, 6:26:00 AM12/15/15
to dea...@googlegroups.com
Thanks Daniel,

Thats was the actual problem. Now it is resolved!

Regards,
Wakil,

Reply all
Reply to author
Forward
0 new messages