Skip to content

Commit

Permalink
shared libs
Browse files Browse the repository at this point in the history
  • Loading branch information
galabovaa committed Jan 15, 2025
1 parent a4079c7 commit 684dfbf
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ message(STATUS "Build Fortran: ${FORTRAN}")
option(CSHARP "Build CSharp interface" OFF)
message(STATUS "Build CSharp: ${CSHARP}")

if (FORTRAN OR CSHARP)
set(BUILD_SHARED_LIBS ON)
endif()

option(PYTHON_BUILD_SETUP "Build Python interface from setup.py" OFF)
message(STATUS "Build Python: ${PYTHON_BUILD_SETUP}")
Expand Down Expand Up @@ -143,7 +140,13 @@ if (BUILD_CXX)
include(GNUInstallDirs)

if(UNIX)
option(BUILD_SHARED_LIBS "Build shared libraries (.so or .dyld)." ON)
# Unix on by default, off for csharp on linux.
if (CSHARP AND (UNIX AND NOT APPLE))
option(BUILD_SHARED_LIBS "Build shared libraries (.so or .dyld)." OFF)
else()
option(BUILD_SHARED_LIBS "Build shared libraries (.so or .dyld)." ON)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
Expand All @@ -155,7 +158,13 @@ if (BUILD_CXX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/${CMAKE_INSTALL_BINDIR})
endforeach()
else()
option(BUILD_SHARED_LIBS "Build shared libraries (.dll)." OFF)
# Windows off by default, on for fortran and csharp.
if (FORTRAN OR CSHARP)
option(BUILD_SHARED_LIBS "Build shared libraries (.dll)." ON)
else()
option(BUILD_SHARED_LIBS "Build shared libraries (.dll)." OFF)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
Expand Down Expand Up @@ -404,9 +413,6 @@ if(NOT FAST_BUILD OR CSHARP)
if(CMAKE_CSharp_COMPILER)
enable_language(CSharp)
set(CSHARP_FOUND ON)
if (UNIX)
set(BUILD_SHARED_LIBS OFF)
endif()
else()
set(CSHARP_FOUND OFF)
endif(CMAKE_CSharp_COMPILER)
Expand Down Expand Up @@ -678,10 +684,6 @@ else(FAST_BUILD)
option(USE_DOTNET_STD_21 "Use .Net Standard 2.1 support" ON)
message(STATUS ".Net: Use .Net Framework 2.1 support: ${USE_DOTNET_STD_21}")

if (CSHARP AND UNIX)
set(BUILD_SHARED_LIBS OFF)
message(STATUS "CSharp: shared libs ${BUILD_SHARED_LIBS}")
endif()

include(dotnet)

Expand Down

0 comments on commit 684dfbf

Please sign in to comment.