Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes compilation with Ninja and IntelLLVM when using OneAPI #544

Merged
merged 3 commits into from
May 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixes compilation with Ninja and IntelLLVM when using OneAPI
lmdiazangulo committed Oct 26, 2023
commit 94f7176066d22e89e242c7faab9b7434e8b84423
41 changes: 30 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -167,8 +167,16 @@ endif ()
#---------------------------------------------

set ( LIB_NAME ${PROJECT_NAME} )
add_library ( ${LIB_NAME} SHARED ${JF_LIB_SRCS} )
add_library ( ${LIB_NAME}-static STATIC ${JF_LIB_SRCS} )
if(CMAKE_Fortran_COMPILER_ID STREQUAL IntelLLVM)
add_library ( ${LIB_NAME}-obj OBJECT ${JF_LIB_SRCS} )
set_property(TARGET ${LIB_NAME}-obj PROPERTY POSITION_INDEPENDENT_CODE 1)

add_library ( ${LIB_NAME} SHARED $<TARGET_OBJECTS:${LIB_NAME}-obj> )
add_library ( ${LIB_NAME}-static STATIC $<TARGET_OBJECTS:${LIB_NAME}-obj> )
else()
add_library ( ${LIB_NAME} SHARED ${JF_LIB_SRCS} )
add_library ( ${LIB_NAME}-static STATIC ${JF_LIB_SRCS} )
endif()

if(JSON_FORTRAN_USE_OpenCoarrays)
target_link_libraries(${LIB_NAME}
@@ -185,15 +193,26 @@ target_include_directories(${LIB_NAME}-static
PUBLIC
$<BUILD_INTERFACE:${MODULE_DIR}>
$<INSTALL_INTERFACE:${INSTALL_MOD_DIR}>)
set_target_properties ( ${LIB_NAME}-static
PROPERTIES
OUTPUT_NAME ${LIB_NAME}
if(NOT MSVC_IDE)
PREFIX lib
endif()
VERSION ${VERSION}
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
Fortran_MODULE_DIRECTORY ${MODULE_DIR} )
if(CMAKE_Fortran_COMPILER_ID STREQUAL IntelLLVM)
set_target_properties ( ${LIB_NAME}-static
PROPERTIES
if(NOT MSVC_IDE)
PREFIX lib
endif()
VERSION ${VERSION}
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
Fortran_MODULE_DIRECTORY ${MODULE_DIR} )
else()
set_target_properties ( ${LIB_NAME}-static
PROPERTIES
OUTPUT_NAME ${LIB_NAME}
if(NOT MSVC_IDE)
PREFIX lib
endif()
VERSION ${VERSION}
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
Fortran_MODULE_DIRECTORY ${MODULE_DIR} )
endif()
set_target_properties ( ${LIB_NAME}
PROPERTIES
OUTPUT_NAME ${LIB_NAME}