An initial investigation shows that DEAL_II_INVOKE_AUTOPILOT calls
add_executable, thus I placed the additional libraries after the macro. Is
that the correct way to solve it?
Am Donnerstag, 11. Januar 2018 14:00:28 UTC+1 schrieb Maxi Miller:
>
> Hei,
> I tried to create my own CMakeLists-file, in order to include a second
> project (which provides a shared library, which should be coupled to the
> main executable). Thus my CMakeLists-file looks now like
> # Set the name of the project and target:
> set(CMAKE_C_COMPILER /usr/lib64/mpi/gcc/openmpi3/bin/mpicc)
> set(CMAKE_CXX_COMPILER /usr/lib64/mpi/gcc/openmpi3/bin/mpic++)
> set(TARGET "main")
> PROJECT(${TARGET})
> set(CMAKE_BUILD_TYPE Debug)
> cmake_policy(SET CMP0015 NEW)
> cmake_policy(SET CMP0003 NEW)
> include_directories("include"
> "../pulse_propagation/include"
> "/opt/dealii/include"
> "/opt/trilinos/include"
> "/opt/intel/tbb/include"
> "/opt/petsc/include"
> "/opt/slepc/include"
> "/opt/p4est/include")
> file(GLOB_RECURSE TARGET_SRC "source/*.cpp")
> file(GLOB_RECURSE TARGET_INC "include/*.h" )
>
> SET(TARGET_SRC ${TARGET_SRC} ${TARGET_INC})
> add_executable(${TARGET} ${TARGET_SRC})
> find_library(PULSE_LIBRARY pulse_propagation HINT ../pulse_propagation/)
> find_library(FILESYSTEM boost_filesystem)
> target_link_libraries(${TARGET} ${FILESYSTEM} ${PULSE_LIBRARY})
> # Usually, you will not need to modify anything beyond this point...
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
>
> FIND_PACKAGE(deal.II 9.0.0 QUIET
> HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
> )
> IF(NOT ${deal.II_FOUND})
> MESSAGE(FATAL_ERROR "\n"
> "*** Could not locate a (sufficiently recent) version of deal.II.
> ***\n\n"
> "You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to
> cmake\n"
> "or set an environment variable \"DEAL_II_DIR\" that contains this
> path."
> )
> ENDIF()
>
>
> DEAL_II_INITIALIZE_CACHED_VARIABLES()
> SET(CLEAN_UP_FILES *.log *.*tu* *.gmv *.gnuplot *.gpl *.eps *.pov *.vtk *.ucd
> *.d2 *.vtu *.pvtu)
> #PROJECT(${TARGET})
> DEAL_II_INVOKE_AUTOPILOT()
> But now the command "DEAL_II_INVOKE_AUTOPILOT()" results in the error
> ADD_EXECUTABLE cannot create target "main" because another target with
> the
> same name already exists. The existing target is an executable created
> in
> source directory
> "~/Documents/heat_equation_with_pulse_propagation/heat_equation".
> See documentation for policy CMP0002 for more details.
> Call Stack (most recent call first):
> CMakeLists.txt:44 (DEAL_II_INVOKE_AUTOPILOT)
>
> Removing the command "add_executable" results in
> CMake Error at CMakeLists.txt:24 (target_link_libraries):
> Cannot specify link libraries for target "main" which is not built by
> this
> project.
>
> What do I have to fix in order to remove the collision with
> DEAL_II_INVOKE_AUTOPILOT?
> Thanks!
>
>
>
>
--
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 the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.