Skip to content

Commit

Permalink
Hide symbols in executable files, we need them in shared libraries only
Browse files Browse the repository at this point in the history
  • Loading branch information
375gnu committed Nov 6, 2023
1 parent fc6fd1e commit 66a0515
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/celestia/gtk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ if (ENABLE_GLES)
target_link_libraries(celestia-gtk celestia ${GLESv2_LIBRARIES})
endif()

set_target_properties(celestia-gtk PROPERTIES CXX_VISIBILITY_PRESET hidden)

install(
TARGETS celestia-gtk
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
2 changes: 2 additions & 0 deletions src/celestia/qt5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ if(USE_WAYLAND)
target_include_directories(celestia-qt5 PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
endif()

set_target_properties(celestia-qt5 PROPERTIES CXX_VISIBILITY_PRESET hidden)

if(APPLE)
# Qt5 and Qt6 installed via homebrew conflict, so re-add the core include directories
target_include_directories(celestia-qt5 PRIVATE ${Qt5Core_INCLUDE_DIRS})
Expand Down
2 changes: 2 additions & 0 deletions src/celestia/qt6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ if(USE_WAYLAND)
target_include_directories(celestia-qt6 PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
endif()

set_target_properties(celestia-qt6 PROPERTIES CXX_VISIBILITY_PRESET hidden)

if(APPLE)
set_property(TARGET celestia-qt6 APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreFoundation")
set_property(TARGET celestia-qt6 APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreServices")
Expand Down
6 changes: 6 additions & 0 deletions src/celestia/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ if(NOT ENABLE_SDL)
endif()

find_package(SDL2 CONFIG REQUIRED)

set(SDL_SOURCES sdlmain.cpp)

add_executable(celestia-sdl ${SDL_SOURCES})
add_dependencies(celestia-sdl celestia)
target_link_libraries(celestia-sdl PRIVATE celestia)

set_target_properties(celestia-sdl PROPERTIES CXX_VISIBILITY_PRESET hidden)

if(TARGET SDL2::SDL2main AND TARGET SDL2::SDL2)
if(MINGW)
target_compile_definitions(celestia-sdl PRIVATE SDL_MAIN_HANDLED)
Expand All @@ -17,6 +22,7 @@ else()
target_include_directories(celestia-sdl PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(celestia-sdl PRIVATE ${SDL2_LIBRARIES})
endif()

install(
TARGETS celestia-sdl
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
3 changes: 3 additions & 0 deletions src/celestia/win32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ add_executable(celestia-win WIN32 ${WIN32_SOURCES} ${RESOURCES})
add_dependencies(celestia-win celestia)
target_link_libraries(celestia-win celestia ${OPENGL_LIBRARIES})
target_include_directories(celestia-win PRIVATE ${OPENGL_INCLUDE_DIRS})

set_target_properties(celestia-win PROPERTIES CXX_VISIBILITY_PRESET hidden)

install(
TARGETS celestia-win
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down

0 comments on commit 66a0515

Please sign in to comment.