Skip to content

Commit

Permalink
link hack for MSVC link.exe with CMake object libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
sksat committed Nov 14, 2024
1 parent cca911f commit 159c9c9
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ set(SOURCE_FILES
src/simulation_sample/ground_station/sample_ground_station.cpp
)

## Create executable file
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

## cspice library
if(APPLE)
if(APPLE_SILICON)
Expand Down Expand Up @@ -180,20 +177,24 @@ if(NOT NRLMSISE00_LIB)
message(FATAL_ERROR "nrlmsise00 not found in ${EXT_LIB_DIR}")
endif()

target_link_libraries(${PROJECT_NAME}
LOGGER
SETTING_FILE_READER
INIH
UTILITIES

COMPONENT
DISTURBANCE
DYNAMICS
GLOBAL_ENVIRONMENT
LOCAL_ENVIRONMENT
MATH_PHYSICS
SIMULATION
# link hack for MSVC link.exe
add_library(lib${PROJECT_NAME}
$<TARGET_OBJECTS:LOGGER>
$<TARGET_OBJECTS:SETTING_FILE_READER>
$<TARGET_OBJECTS:INIH>
$<TARGET_OBJECTS:UTILITIES>

$<TARGET_OBJECTS:COMPONENT>
$<TARGET_OBJECTS:DISTURBANCE>
$<TARGET_OBJECTS:DYNAMICS>
$<TARGET_OBJECTS:GLOBAL_ENVIRONMENT>
$<TARGET_OBJECTS:LOCAL_ENVIRONMENT>
$<TARGET_OBJECTS:MATH_PHYSICS>
$<TARGET_OBJECTS:SIMULATION>
)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

target_link_libraries(${PROJECT_NAME}
# ExtLibraries
${NRLMSISE00_LIB}
${CSPICE_LIB}
Expand Down

0 comments on commit 159c9c9

Please sign in to comment.