Skip to content

Commit

Permalink
Revert "CMake: Split fortran/c sources"
Browse files Browse the repository at this point in the history
This reverts commit 97c50ce.
  • Loading branch information
jschueller committed Dec 30, 2023
1 parent 55d40e5 commit adcc45c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,6 @@ endmacro
evals
primac
primaf
primafc
cintrf
COBJ
COBJCON
Expand Down
20 changes: 7 additions & 13 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
# Fortran object files must be in a separate library as VS generator does not support mixing C and Fortran
add_library (primafc OBJECT cintrf.f90 cobyla_c.f90 lincoa_c.f90 bobyqa_c.f90 newuoa_c.f90 uobyqa_c.f90)
set_target_properties(primafc PROPERTIES POSITION_INDEPENDENT_CODE ON)
if (NOT BUILD_SHARED_LIBS)
target_link_libraries (primafc INTERFACE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
endif ()
target_link_libraries (primafc PUBLIC primaf) # must be PUBLIC for precision macros

# now the C-only library
add_library (primac prima.c)
add_library (primac cintrf.f90 cobyla_c.f90 lincoa_c.f90 bobyqa_c.f90 newuoa_c.f90 uobyqa_c.f90 prima.c)
if (WIN32)
set_target_properties(primac PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
endif()


target_include_directories (primac PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>>)
target_link_libraries (primac PRIVATE primafc)
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_link_libraries (primac PUBLIC primaf) # must be PUBLIC for precision macros
set_target_properties(primac PROPERTIES POSITION_INDEPENDENT_CODE ON C_STANDARD 99)

if (NOT BUILD_SHARED_LIBS)
target_compile_definitions(primac PUBLIC PRIMAC_STATIC)
target_link_libraries (primac INTERFACE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
endif ()

# Export symbols on Windows. See more comments in fortran/CMakeLists.txt.
Expand Down

0 comments on commit adcc45c

Please sign in to comment.