1
-
2
-
3
1
#
4
2
# Setup CMake policies.
5
3
#
82
80
set (BUILD_SHARED_LIBS "ON" )
83
81
#set(DEBUG_FLAGS "-g -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
84
82
set (DEBUG_FLAGS "-g" )
83
+ set (CMAKE_CXX_STANDARD 17)
85
84
if (CYGWIN )
86
85
set (ADDITIONAL_FLAGS "-D_GLIBCXX_USE_C99" )
87
86
set (CXX_STANDARD "gnu++17" )
88
87
else ()
89
88
set (ADDTIONAL_FLAGS "" )
90
89
set (CXX_STANDARD "c++17" )
91
90
endif ()
91
+
92
+ set (LINK_UNRESOLVED "-Wl,--unresolved-symbols=ignore-all" )
93
+ if (APPLE )
94
+ set (LINK_UNRESOLVED "-undefined dynamic_lookup" )
95
+ endif ()
96
+
97
+
92
98
#set(CMAKE_C_FLAGS_DEBUG " -Wall -fsanitize=address ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)
93
99
set (CMAKE_C_FLAGS_DEBUG " -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS} " CACHE STRING "C Compiler Debug options." FORCE)
94
100
set (CMAKE_C_FLAGS_RELEASE " -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE)
@@ -159,11 +165,15 @@ endif()
159
165
endmacro ()
160
166
#
161
167
# sets that a library is expected to have unresolved symbols
162
- # Usage: set_library_unresolved_symbols (<PROJECT>)
168
+ # Usage: set_has_unresolved_symbols (<PROJECT>)
163
169
#
164
170
# Should be used before set_libraries_path.
165
171
macro (set_has_unresolved_symbols configname)
166
- set (${configname} _LIBRARIES "-Wl,--unresolved-symbols=ignore-all" ${${configname} _LIBRARIES})
172
+ if ( TARGET ${configname} )
173
+ set_target_properties ( ${configname} PROPERTIES LINK_FLAGS ${LINK_UNRESOLVED} )
174
+ else ()
175
+ set (${configname} _LIBRARIES ${LINK_UNRESOLVED} ${${configname} _LIBRARIES})
176
+ endif ()
167
177
endmacro ()
168
178
169
179
#
@@ -295,34 +305,13 @@ endif()
295
305
# Find Qwt, correlated to the Qt version.
296
306
#
297
307
macro (setup_qwt)
298
- if (WITH_QT4)
299
- find_path (QWT_INCLUDE_DIR NAMES qwt.h
300
- PATHS /usr/include /qwt-qt4
301
- /opt/local/libexec/qt4/include
302
- /usr/include /qt4
303
- /usr/include
304
- PATH_SUFFIXES qwt )
305
- find_library (QWT_LIBRARY NAMES qwt-qt4 qwt
306
- PATHS /opt/local/libexec/qt4/lib
307
- /usr/lib64
308
- /usr/lib )
309
- else ()
310
- find_path (QWT_INCLUDE_DIR NAMES qwt.h
311
- PATHS /usr/include /qt5
312
- /usr/include
313
- PATH_SUFFIXES qwt )
314
- find_library (QWT_LIBRARY NAMES qwt-qt5 qwt
315
- PATHS /usr/lib64
316
- /usr/lib )
317
- endif ()
318
-
319
- if ( QWT_INCLUDE_DIR AND QWT_LIBRARY)
320
- set (QWT_FOUND TRUE )
321
- endif ()
322
-
308
+ find_package (PkgConfig)
309
+ pkg_search_module(QWT REQUIRED Qt5Qwt6)
323
310
if (QWT_FOUND)
311
+ set ( QWT_LIBRARY ${QWT_LINK_LIBRARIES} )
312
+ set ( QWT_INCLUDE_DIR ${QWT_CFLAGS} )
324
313
if (NOT QWT_FIND_QUIETLY)
325
- message (STATUS "-- Found Qwt: ${QWT_LIBRARY} " )
314
+ message (STATUS "-- Found Qwt: libs: ${QWT_LIBRARY} cflags: ${QWT_INCLUDE_DIR } " )
326
315
endif ()
327
316
else ()
328
317
if (QWT_FIND_REQUIRED)
@@ -425,12 +414,12 @@ endif()
425
414
list ( GET clibSpec 2 soversion )
426
415
set ( pyDeplibs ${clib} ${deplibs} )
427
416
428
- add_library ( ${clib} ${pyCpps} )
429
- set_target_properties ( ${clib} PROPERTIES VERSION ${version} SOVERSION ${soversion} )
430
- #target_compile_definitions( ${clib} PUBLIC Py_LIMITED_API=1)
431
- target_link_libraries ( ${clib} ${deplibs} )
417
+ add_library ( ${clib} ${pyCpps} )
418
+ set_target_properties ( ${clib} PROPERTIES VERSION ${version} SOVERSION ${soversion} )
419
+ #target_compile_definitions( ${clib} PUBLIC Py_LIMITED_API=1)
420
+ target_link_libraries ( ${clib} ${deplibs} )
421
+ set_has_unresolved_symbols( ${clib} )
432
422
install ( TARGETS ${clib} DESTINATION lib${LIB_SUFFIX} )
433
- target_link_options ( ${clib} PRIVATE "LINKER:--unresolved-symbols=ignore-all" )
434
423
endif ()
435
424
436
425
set ( pytarget "${pymodule} _target" )
@@ -443,8 +432,7 @@ endif()
443
432
)
444
433
#target_compile_definitions( ${pytarget} PUBLIC Py_LIMITED_API=1)
445
434
target_link_libraries ( ${pytarget} ${pyDeplibs} )
446
- target_link_options ( ${pytarget} PRIVATE "LINKER:--unresolved-symbols=ignore-all" )
447
-
435
+ set_has_unresolved_symbols( ${pytarget} )
448
436
install ( TARGETS ${pytarget} DESTINATION ${Python_CORIOLISARCH} )
449
437
if ( NOT ("${pyIncludes} " STREQUAL "None" ) )
450
438
install ( FILES ${pyIncludes} DESTINATION ${inc_install_dir} )
@@ -466,6 +454,7 @@ endif()
466
454
add_library ( ${pymodule} MODULE ${pyCpps} )
467
455
set_target_properties ( ${pymodule} PROPERTIES PREFIX "" )
468
456
target_link_libraries ( ${pymodule} ${deplibs} )
457
+ set_has_unresolved_symbols( ${pymodule} )
469
458
# target_compile_definitions( ${pymodule} PUBLIC Py_LIMITED_API=1)
470
459
471
460
install ( TARGETS ${pymodule} DESTINATION ${Python_CORIOLISARCH} )
0 commit comments