From c8388746b9daf6e9911f1008e89aef8af55b8b68 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 13 Sep 2016 12:51:17 -0400 Subject: [PATCH] Fix build under Sun Studio --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6d2e631..3d35f5b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ if(WINDOWS_STORE OR WINDOWS_PHONE) endif() SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI\"winapifamily.h\"" ) endif() + #============================================================================ # Sources & headers #============================================================================ @@ -213,6 +214,7 @@ endif() #============================================================================ # Third-party libraries #============================================================================ + if(WIN32) if (BUILD_STATIC) target_link_libraries(cryptopp-static ws2_32) @@ -222,6 +224,16 @@ if(WIN32) endif() endif() +# This may need to be expanded to "Solaris" +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro") + if (BUILD_STATIC) + target_link_libraries(cryptopp-static nsl socket) + endif() + if (BUILD_SHARED) + target_link_libraries(cryptopp-shared nsl socket) + endif() +endif() + find_package(Threads) if (BUILD_STATIC) target_link_libraries(cryptopp-static ${CMAKE_THREAD_LIBS_INIT}) @@ -233,6 +245,7 @@ endif() #============================================================================ # Tests #============================================================================ + enable_testing() if(BUILD_TESTING) add_executable(cryptest ${cryptopp_SOURCES_TEST}) @@ -258,6 +271,7 @@ endif() #============================================================================ # Doxygen documentation #============================================================================ + if(BUILD_DOCUMENTATION) find_package(Doxygen REQUIRED) @@ -282,6 +296,7 @@ endif() #============================================================================ # Install #============================================================================ + set(export_name "cryptopp-targets") # Runtime package @@ -317,7 +332,6 @@ if(BUILD_TESTING) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/TestVectors DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) endif() - # Documentation if(BUILD_DOCUMENTATION) install(DIRECTORY "${out_source_DOCS_DIR}" DESTINATION ${CMAKE_INSTALL_DOCDIR})