configure dso

This commit is contained in:
janbar 2019-12-02 19:40:25 +01:00
parent 02f5d0265d
commit f4047cd59c
2 changed files with 28 additions and 4 deletions

View File

@ -39,11 +39,27 @@ file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/opensslconf.h.cmake "${CONF}" )
#~2DO: set BUILDINF_DATE to `date LC_ALL=C LC_TIME=C`
configure_file ( buildinf.h.cmake buildinf.h )
include( CheckIncludeFile )
CHECK_INCLUDE_FILE( fcntl.h CHK_DLFCN )
if( CHK_DLFCN )
set( HAVE_DLFCN_H ON )
endif()
if ( APPLE )
set( DSO_DLFCN ON )
set( DSO_EXTENSION ".dylib" )
elseif ( WIN32 )
elseif ( WIN32 AND NOT CYGWIN )
set( DSO_WIN32 ON )
set( DSO_EXTENSION ".dll" )
elseif ( CYGWIN )
set( DSO_DLFCN ON )
set( DSO_EXTENSION ".dll" )
else()
if( CHK_DLFCN )
set( DSO_DLFCN ON )
else()
set( DSO_NONE ON )
endif()
set( DSO_EXTENSION ".so" )
endif()
@ -271,8 +287,13 @@ add_library( crypto ${LIBSRC} ${OBJECTS_SRC} )
if( WIN32 AND NOT CYGWIN )
target_link_libraries( crypto ws2_32 crypt32 )
elseif( Threads_FOUND )
target_link_libraries( crypto ${CMAKE_THREAD_LIBS_INIT} )
else()
if( Threads_FOUND )
target_link_libraries( crypto ${CMAKE_THREAD_LIBS_INIT} )
endif()
if ( DSO_DLFCN AND HAVE_DLFCN_H )
target_link_libraries( crypto dl )
endif()
endif()
set_target_properties( crypto PROPERTIES

View File

@ -9,6 +9,9 @@
#ifndef HEADER_DSO_CONF_H
# define HEADER_DSO_CONF_H
# define DSO_EXTENSION "@DSO_EXTENSION@"
#cmakedefine DSO_NONE
#cmakedefine DSO_WIN32
#cmakedefine DSO_DLFCN
#cmakedefine HAVE_DLFCN_H
#endif