|
1 | 1 | ## Process this file with cmake |
2 | 2 | #============================================================================== |
3 | 3 | # NeXus - Neutron & X-ray Common Data Format |
4 | | -# |
| 4 | +# |
5 | 5 | # CMakeLists for building the NeXus library and applications. |
6 | 6 | # |
7 | 7 | # Copyright (C) 2011 Stephen Rankin |
8 | | -# |
| 8 | +# |
9 | 9 | # This library is free software; you can redistribute it and/or modify it under |
10 | 10 | # the terms of the GNU Lesser General Public License as published by the Free |
11 | 11 | # Software Foundation; either version 2 of the License, or (at your option) any |
12 | 12 | # later version. |
13 | | -# |
| 13 | +# |
14 | 14 | # This library is distributed in the hope that it will be useful, but WITHOUT |
15 | 15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
16 | 16 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
17 | 17 | # details. |
18 | | -# |
| 18 | +# |
19 | 19 | # You should have received a copy of the GNU Lesser General Public License |
20 | 20 | # along with this library; if not, write to the Free Software Foundation, Inc., |
21 | 21 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | | -# |
| 22 | +# |
23 | 23 | # For further information, see <http://www.nexusformat.org> |
24 | 24 | # |
25 | 25 | # |
26 | 26 | #============================================================================== |
27 | 27 |
|
28 | | -add_definitions(-DIN_NEXUS_CPP_LIBRARY=1 ${NX_CPP}) |
29 | | - |
| 28 | +include(GenerateExportHeader) |
30 | 29 | #Make NeXus CPP Bindings Static Library |
31 | 30 |
|
32 | 31 | set (HEADERS NeXusFile.hpp NeXusException.hpp NeXusStream.hpp) |
33 | | -set (SOURCES NeXusFile.hpp NeXusFile.cpp NeXusException.hpp |
| 32 | +set (SOURCES NeXusFile.hpp NeXusFile.cpp NeXusException.hpp |
34 | 33 | NeXusException.cpp NeXusStream.hpp NeXusStream.cpp) |
35 | 34 |
|
36 | 35 | set_property(SOURCE ${SOURCES} APPEND PROPERTY COMPILE_FLAGS ${NX_CFLAGS}) |
37 | 36 |
|
38 | | -#------------------------------------------------------------------------------ |
39 | | -add_library (NeXus_CPP_Static_Library STATIC ${HEADERS} ${SOURCES}) |
40 | | -set_target_properties(NeXus_CPP_Static_Library PROPERTIES |
41 | | - OUTPUT_NAME NeXusCPP${STATIC_LIBRARY_SUFFIX}) |
42 | | - |
43 | | -target_link_libraries(NeXus_CPP_Static_Library NeXus_Static_Library) |
44 | | - |
45 | 37 | #Make NeXus CPP Bindings Shared Library |
46 | 38 | #------------------------------------------------------------------------------ |
47 | 39 | add_library (NeXus_CPP_Shared_Library SHARED ${HEADERS} ${SOURCES}) |
48 | 40 | target_link_libraries(NeXus_CPP_Shared_Library NeXus_Shared_Library) |
| 41 | +target_include_directories(NeXus_CPP_Shared_Library PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ) |
49 | 42 | set_target_properties(NeXus_CPP_Shared_Library PROPERTIES |
50 | 43 | OUTPUT_NAME NeXusCPP |
51 | 44 | VERSION "${ABI_VERSION}" |
52 | 45 | SOVERSION ${ABI_CURRENT}) |
53 | 46 |
|
| 47 | +generate_export_header(NeXus_CPP_Shared_Library |
| 48 | + BASE_NAME NEXUS_CPP |
| 49 | + EXPORT_FILE_NAME NeXusExport.hpp |
| 50 | + EXPORT_MACRO_NAME NXDLL_EXPORT) |
| 51 | + |
| 52 | +#------------------------------------------------------------------------------ |
| 53 | +add_library (NeXus_CPP_Static_Library STATIC ${HEADERS} ${SOURCES}) |
| 54 | +set_target_properties(NeXus_CPP_Static_Library PROPERTIES |
| 55 | + OUTPUT_NAME NeXusCPP${STATIC_LIBRARY_SUFFIX} |
| 56 | + COMPILE_FLAGS -DNEXUS_CPP_STATIC_DEFINE) |
| 57 | +target_include_directories(NeXus_CPP_Static_Library PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ) |
| 58 | +target_link_libraries(NeXus_CPP_Static_Library NeXus_Static_Library) |
| 59 | + |
| 60 | + |
| 61 | +#------------------------------------------------------------------------------ |
| 62 | + |
54 | 63 | install (TARGETS NeXus_CPP_Shared_Library |
55 | 64 | RUNTIME DESTINATION ${NEXUS_INSTALL_SHLIB} COMPONENT Runtime |
56 | 65 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development |
57 | 66 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development) |
58 | 67 |
|
59 | | -install (TARGETS NeXus_CPP_Static_Library |
| 68 | +install (TARGETS NeXus_CPP_Static_Library |
60 | 69 | DESTINATION ${CMAKE_INSTALL_LIBDIR} |
61 | 70 | COMPONENT Development) |
62 | 71 |
|
63 | | -INSTALL (FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nexus |
| 72 | +INSTALL (FILES ${HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/NeXusExport.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nexus |
64 | 73 | COMPONENT Development) |
65 | 74 |
|
66 | | - |
67 | | - |
68 | | - |
|
0 commit comments