Skip to content

Commit

Permalink
moved target devinition
Browse files Browse the repository at this point in the history
  • Loading branch information
lausdahl committed Mar 14, 2024
1 parent a7f9b7c commit bdea4c0
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions jnifmuapi/src/main/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,36 @@ file(GLOB CPP_FILES src/*.cpp)
file(GLOB C_FILES_3 src/fmi3/*.c) # ../includes/templates/*.c)
file(GLOB CPP_FILES_3 src/fmi3/*.cpp)


add_library(${PROJECT_NAME} SHARED ${C_FILES} ${CPP_FILES} ${C_FILES_3} ${CPP_FILES_3})

add_definitions(-DSTANDALONE_XML_PARSER -DLIBXML_STATIC -DFMI_COSIMULATION)

#target_link_libraries(${PROJECT_NAME} libshmfmi)
#target_link_libraries(${PROJECT_NAME} ${libshmfmi_LIBS})


foreach (LETTER ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})

if (EXISTS "${LETTER}/libstdc++.a")
# message (STATUS "${LETTER}")
set(STDCPP_LIBRARY "${LETTER}/libstdc++.a")
else ()
# message (STATUS "${LETTER} ---- not these")
endif ()
endforeach ()

message(STATUS "Static linking with libstdc++.a in ${STDCPP_LIBRARY}")
target_link_libraries(${PROJECT_NAME} ${STDCPP_LIBRARY})

#find_library(PTHREAD_LIBRARY NAMES libpthread.a)
#target_link_libraries(${PROJECT_NAME} ${PTHREAD_LIBRARY})


if (UNIX)

set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
if (APPLE)
else ()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++ -static")
endif ()
endif ()
if (WIN32)
#windows
Expand All @@ -87,21 +100,6 @@ if (WIN32)
SET_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
endif ()

add_library(${PROJECT_NAME} SHARED ${C_FILES} ${CPP_FILES} ${C_FILES_3} ${CPP_FILES_3})

foreach (LETTER ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})

if (EXISTS "${LETTER}/libstdc++.a")
# message (STATUS "${LETTER}")
set(STDCPP_LIBRARY "${LETTER}/libstdc++.a")
else ()
# message (STATUS "${LETTER} ---- not these")
endif ()
endforeach ()

message(STATUS "Static linking with libstdc++.a in ${STDCPP_LIBRARY}")
target_link_libraries(${PROJECT_NAME} ${STDCPP_LIBRARY})

include(JavaPlatformFolder.cmake)
get_java_osarch_folder(output_folders)

Expand Down

0 comments on commit bdea4c0

Please sign in to comment.