Hello deal.ii community,

I am posting again (sorry) with a bit more info since I did not find the 
mistake in my cmake setup. I have essentially the following project 
structure:

project/source
project/include
project/doc
project/test. 

In project/ I have this CMakeLists.txt:

#############################################################
#############################################################
# Macro to print all arguments
macro (print_all_args)
  message (STATUS "------------------------------------")
  
  set(list_var "${ARGN}")
  foreach(_currentItem IN LISTS list_var)
    message (STATUS "Adding library source file:   ${_currentItem}")
  endforeach (_currentItem)
  
  message (STATUS "------------------------------------")
endmacro (print_all_args)
#############################################################
#############################################################



###############################################################################
###############################################################################
message(STATUS "This is CMake ${CMAKE_VERSION}")
message(STATUS "")

cmake_minimum_required(VERSION 2.8.12)

find_package(deal.II 9.1.1 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(PROJECT_NAME MsFEComplex)

# The version number
set(MsFEComplex_VER_MAJOR 0)
set(MsFEComplex_VER_MINOR 1)

project(${PROJECT_NAME})
###############################################################################
###############################################################################



###############################################################################
###############################################################################
# Check for the existence of various optional folders:
if (EXISTS ${CMAKE_SOURCE_DIR}/doc/CMakeLists.txt)
  set(MsFEComplex_HAVE_DOC_DIRECTORY TRUE)
endif ()

if (EXISTS ${CMAKE_SOURCE_DIR}/test/CMakeLists.txt)
  set (MsFEComplex_HAVE_TEST_DIRECTORY TRUE)
endif ()
###############################################################################
###############################################################################



###############################################################################
###############################################################################
# Change default CMAKE_INSTAL_PREFIX to ${CMAKE_BINARY_DIR}/lib
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/lib" CACHE PATH "default 
install path" FORCE )
endif ()

set (MsFEComplex_LIBRARY msfecomplex)
###############################################################################
###############################################################################



###############################################################################
###############################################################################
set(MsFEComplex_INCLUDE_DIR
${CMAKE_SOURCE_DIR}/include)

set(MsFEComplex_SRC_DIR 
${CMAKE_SOURCE_DIR}/source)
add_subdirectory (${MsFEComplex_SRC_DIR})


# Only add subdirectories for doc if exists
if (MsFEComplex_HAVE_DOC_DIRECTORY)
  add_subdirectory (${CMAKE_SOURCE_DIR}/doc)
endif ()

# Only add subdirectories for doc if exists
if (MsFEComplex_HAVE_TEST_DIRECTORY)
  add_subdirectory (${CMAKE_SOURCE_DIR}/test)
  ENABLE_TESTING()
endif ()
###############################################################################
###############################################################################



###############################################################################
###############################################################################
ADD_CUSTOM_TARGET(debug
  COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
  COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
  COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
  )

ADD_CUSTOM_TARGET(release
  COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
  COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
  COMMENT "Switch CMAKE_BUILD_TYPE to Release"
  )
###############################################################################
###############################################################################


and in project/source I have:


###############################################################################
###############################################################################
#
# Include directory for sources
#
include_directories(${MsFEComplex_INCLUDE_DIR})
###############################################################################
###############################################################################


###############################################################################
###############################################################################
#
# Name all sources
#
#file(GLOB_RECURSE MsFEComplex_TARGET_LIB_SRC  "*.cc") # source files
#set(MsFEComplex_TARGET_LIB_SRC ${MsFEComplex_TARGET_LIB_SRC})
set(MsFEComplex_TARGET_LIB_SRC
eqn_boundary_vals.cc
eqn_coeff_A.cc
eqn_coeff_B.cc
eqn_coeff_R.cc
eqn_exact_solution_lin.cc
eqn_rhs.cc
my_vector_tools.inst.cc
ned_rt_basis.cc
ned_rt_global.cc
ned_rt_post_processor.cc
ned_rt_ref.cc
parameters.cc
q_ned_basis.cc
q_ned_global.cc
q_ned_post_processor.cc
q_ned_ref.cc)

print_all_args (
  ${MsFEComplex_TARGET_LIB_SRC}
 )
###############################################################################
###############################################################################


###############################################################################
###############################################################################
#
# Compile and link the sources as SHARED
#
add_library (MsFEComplex_LIBRARY SHARED ${MsFEComplex_TARGET_LIB_SRC})
DEAL_II_SETUP_TARGET(MsFEComplex_LIBRARY)

#
# Install into the DESTINATION provided by CMAKE_INSTALL_PREFIX
#
#install (TARGETS ${MsFEComplex_LIBRARY} DESTINATION 
${CMAKE_INSTALL_PREFIX})

add_executable(MsFEComplex_Ned_RT "main_ned_rt.cxx")
DEAL_II_SETUP_TARGET(MsFEComplex_Ned_RT)
TARGET_LINK_LIBRARIES(MsFEComplex_Ned_RT MsFEComplex_LIBRARY)

add_executable(MsFEComplex_Q_Ned "main_q_ned.cxx")
DEAL_II_SETUP_TARGET(MsFEComplex_Q_Ned)
TARGET_LINK_LIBRARIES(MsFEComplex_Q_Ned MsFEComplex_LIBRARY)
###############################################################################
###############################################################################

So essentially I want to build a library and then link two executables to 
it. It compiles correctly but very slow since I can not invoke *make -j8*  

Google unfortunately does not help.

Any help would be much appreciated.

Best,
Konrad

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/664a11a3-fcf8-46a8-92ef-42220bc8862b%40googlegroups.com.

Reply via email to