diff --git a/CMakeLists.txt b/CMakeLists.txt index 46937b2..67ddec5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1748,6 +1748,7 @@ endforeach() if(ENABLE_BUILD_LIB) add_library(lib STATIC ${GMSH_SRC}) set_target_properties(lib PROPERTIES OUTPUT_NAME gmsh) + target_link_libraries(lib ${LINK_LIBRARIES}) if(MSVC) set_target_properties(lib PROPERTIES DEBUG_POSTFIX d) if(ENABLE_MSVC_STATIC_RUNTIME) @@ -1793,26 +1794,23 @@ endif() # binary targets if(HAVE_FLTK) - if(ENABLE_BUILD_DYNAMIC) - add_executable(gmsh WIN32 src/common/Main.cpp) - target_link_libraries(gmsh shared) - else() - add_executable(gmsh WIN32 src/common/Main.cpp ${GMSH_SRC}) - endif() + add_executable(gmsh WIN32 src/common/Main.cpp) # we could add this to create a minimal app bundle even without install # if(APPLE AND NOT ENABLE_OS_SPECIFIC_INSTALL) # set_target_properties(gmsh PROPERTIES MACOSX_BUNDLE ON # MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/utils/misc/gmsh_dev.plist) # endif() else() - if(ENABLE_BUILD_DYNAMIC) - add_executable(gmsh src/common/Main.cpp) - target_link_libraries(gmsh shared) - else() - add_executable(gmsh src/common/Main.cpp ${GMSH_SRC}) - endif() + add_executable(gmsh src/common/Main.cpp) +endif() +if(TARGET shared) + target_link_libraries(gmsh shared) +elseif(TARGET lib) + target_link_libraries(gmsh lib) +else() + target_sources(gmsh ${GMSH_SRC}) endif() -target_link_libraries(gmsh ${LINK_LIBRARIES}) +set_target_properties(gmsh PROPERTIES PDB_NAME gmsh.exe) # OS specific linker options if(WIN32 AND NOT MSVC)