Cleaned up endif/else-s in CMakeLists.txt and *.cmake files
[alexxy/gromacs.git] / src / gromacs / gmxlib / thread_mpi / CMakeLists.txt
1
2 # Note that not all .c files are compiled directly: some of them 
3 # are #included (some multiple times) from other source files.
4 set(THREAD_MPI_LIB_SOURCE 
5     alltoall.c      reduce.c        scan.c
6     barrier.c       list.c          reduce_fast.c
7     bcast.c         lock.c          scatter.c
8     collective.c    once.c          tmpi_init.c
9     comm.c          p2p_protocol.c  topology.c
10     errhandler.c    p2p_send_recv.c type.c
11     event.c         p2p_wait.c      tmpi_malloc.c
12     gather.c        profile.c
13     group.c         numa_malloc.c   atomic.c)
14
15
16 if (THREAD_PTHREADS)
17     set(THREAD_MPI_LIB_SOURCE pthreads.c ${THREAD_MPI_LIB_SOURCE})
18 else (THREAD_PTHREADS)
19     if (THREAD_WINDOWS)
20         set(THREAD_MPI_LIB_SOURCE winthreads.c ${THREAD_MPI_LIB_SOURCE})
21     endif()
22 endif()
23
24
25 add_library(thread_mpi STATIC ${THREAD_MPI_LIB_SOURCE})
26
27 # make it link to the threads library (-lpthreads, for example)
28 target_link_libraries(thread_mpi ${THREAD_LIB})
29
30 if (TMPI_CXX_LIB)
31     set(THREAD_MPI_CXX_LIB_SOURCE
32         system_error.cpp )
33     add_library(thread_mpi_cxx STATIC ${THREAD_MPI_CXX_LIB_SOURCE})
34     target_link_libraries(thread_mpi_cxx thread_mpi)
35 endif()
36
37 #configure_file(tmpi_config.h.cmakein  tmpi_config.h)
38 #add_definitions(-DHAVE_TMPI_CONFIG_H)
39 #include_directories( . )
40
41 # this configure file only works here. If you include the source
42 # files into your project, insert the contest of the tmpi_config.h.cmakein
43 # into your config.h.cmakein file
44 configure_file(tmpi_config.h.cmakein  ${CMAKE_CURRENT_BINARY_DIR}/tmpi_config.h)
45 include_directories(${CMAKE_CURRENT_BINARY_DIR})
46 add_definitions(-DHAVE_TMPI_CONFIG_H)
47
48 install(TARGETS thread_mpi DESTINATION lib)