CMakeLists.txt 2.78 KB
Newer Older
1 2 3 4 5 6
### CMakeLists.txt --- 
## 
## Author: Julien Wintz
## Copyright (C) 2008-2011 - Julien Wintz, Inria.
## Created: Thu Mar  1 14:34:49 2012 (+0100)
## Version: $Id$
7
## Last-Updated: lun. févr.  3 13:08:02 2014 (+0100)
8
##           By: Nicolas Niclausse
9
##     Update #: 41
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
######################################################################
## 
### Commentary: 
## 
######################################################################
## 
### Change log:
## 
######################################################################

project(dtkLog)

## #################################################################
## Sources
## #################################################################

set(${PROJECT_NAME}_HEADERS
  dtkLog.h
  dtkLogger.h
29
  dtkLogger_p.h
30
  dtkLogEngine.h
Julien Wintz's avatar
Julien Wintz committed
31
  dtkLogDestination.h
Julien Wintz's avatar
Julien Wintz committed
32
  dtkLogModel.h
33 34
  dtkLogView.h
  dtkLogView_p.h)
35 36

set(${PROJECT_NAME}_SOURCES
37
  dtkLog.cpp
38 39
  dtkLogger.cpp
  dtkLogEngine.cpp
Julien Wintz's avatar
Julien Wintz committed
40
  dtkLogDestination.cpp
Julien Wintz's avatar
Julien Wintz committed
41
  dtkLogModel.cpp
Julien Wintz's avatar
Julien Wintz committed
42
  dtkLogView.cpp)
43 44 45 46 47

## #################################################################
## Build rules
## #################################################################

48
add_library(${PROJECT_NAME}
49 50
  ${${PROJECT_NAME}_SOURCES}
  ${${PROJECT_NAME}_HEADERS}
51
)
52

53 54
qt5_use_modules(${PROJECT_NAME} Core)
qt5_use_modules(${PROJECT_NAME} Widgets)
55 56 57 58

target_link_libraries(${PROJECT_NAME}
  ${QT_LIBRARIES})

59 60 61 62
if(DTK_HAVE_MPI)
target_link_libraries(${PROJECT_NAME} ${MPI_LIBRARIES})
endif(DTK_HAVE_MPI)

63 64 65 66 67 68 69 70 71 72
## #################################################################
## Export header file
## #################################################################

add_compiler_export_flags()

generate_export_header(${PROJECT_NAME}
  EXPORT_FILE_NAME "${PROJECT_NAME}Export.h")

add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
73 74
  COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Export.h" "${CMAKE_BINARY_DIR}"
  COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Export.h" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export")
75 76 77

set(${PROJECT_NAME}_HEADERS
  ${${PROJECT_NAME}_HEADERS}
78
 "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export.h")
79

80 81 82 83 84 85 86 87 88 89 90 91 92
## #################################################################
## Installation
## #################################################################

foreach(header ${${PROJECT_NAME}_HEADERS})
  string(REGEX REPLACE "(.*)\\.h\$" "\\1" h ${header})
  set(${PROJECT_NAME}_HEADERS_QTS "${${PROJECT_NAME}_HEADERS_QTS}" ${h})
endforeach(header)

install(FILES ${${PROJECT_NAME}_HEADERS} DESTINATION include/${PROJECT_NAME})
install(FILES ${${PROJECT_NAME}_HEADERS_QTS} DESTINATION include/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME}
  RUNTIME DESTINATION bin
93 94
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})