|
Revision 694, 1.1 kB
(checked in by tapted, 2 years ago)
|
|
Allow SuggestCXXFlag to be found in SOURCE_DIR
|
-
Property svn:eol-style set to
native
|
| Rev | Line | |
|---|
| [686] | 1 | PROJECT(rconfig) |
|---|
| [690] | 2 | OPTION(use_boost "Use Boost regex if available" ON) |
|---|
| 3 | |
|---|
| 4 | if (use_boost) |
|---|
| 5 | FIND_PACKAGE(Boost) |
|---|
| 6 | endif(use_boost) |
|---|
| 7 | |
|---|
| [694] | 8 | SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${rconfig_SOURCE_DIR}") |
|---|
| [686] | 9 | INCLUDE(SuggestCXXFlag) |
|---|
| 10 | SUGGEST_CXX_FLAGS("-pedantic;-W;-Wall;-Wextra;-Wshadow;-Wcast-qual;-Wwrite-strings;-Woverloaded-virtual" CMAKE_CXX_FLAGS) |
|---|
| 11 | |
|---|
| 12 | INCLUDE_DIRECTORIES(${mylib_SOURCE_DIR}) |
|---|
| 13 | |
|---|
| 14 | ADD_LIBRARY(rconfig SHARED rconfig.cpp rconfig.h) |
|---|
| 15 | |
|---|
| [690] | 16 | if (Boost_FOUND) |
|---|
| 17 | ADD_DEFINITIONS(-DHAVE_BOOST) |
|---|
| 18 | INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) |
|---|
| 19 | LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) |
|---|
| 20 | TARGET_LINK_LIBRARIES(rconfig boost_regex) |
|---|
| 21 | |
|---|
| 22 | else (Boost_FOUND) |
|---|
| 23 | TARGET_LINK_LIBRARIES(rconfig rxstring) |
|---|
| 24 | |
|---|
| 25 | endif (Boost_FOUND) |
|---|
| 26 | |
|---|
| 27 | |
|---|
| [686] | 28 | SET_TARGET_PROPERTIES(rconfig PROPERTIES |
|---|
| 29 | LINK_FLAGS -Wl,-no-undefined) |
|---|
| 30 | |
|---|
| 31 | #set_target_properties(rconfig PROPERTIES VERSION 4.2.0 SOVERSION 4) |
|---|
| 32 | |
|---|
| [693] | 33 | ADD_EXECUTABLE(hello_world hello_world.cpp) |
|---|
| 34 | TARGET_LINK_LIBRARIES(hello_world rconfig) |
|---|
| 35 | |
|---|
| [686] | 36 | INSTALL(FILES rconfig.h DESTINATION include) |
|---|
| 37 | INSTALL(TARGETS rconfig |
|---|
| 38 | LIBRARY DESTINATION lib |
|---|
| 39 | RUNTIME DESTINATION bin) |
|---|