Skip to content

Commit

Permalink
Fix static link.
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat committed Jul 30, 2017
1 parent 2d928da commit bf6821e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake
add_definitions(-DHAVE_CONFIG_H=1)


# Add subdirectories
# Set include dirs

include_directories(
${CMAKE_SOURCE_DIR}/include
Expand All @@ -51,20 +51,24 @@ if(SSM_FOUND)
)
endif(SSM_FOUND)

add_subdirectory(auxlib)
add_subdirectory(samples)


# Static link options

option(ENABLE_ALL_STATIC "Static link libgcc and libstdc++." OFF)
set(TARGET_STATIC_POSTFIX "")
if(ENABLE_ALL_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc")
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc")
set(TARGET_STATIC_POSTFIX "-static")
endif(ENABLE_ALL_STATIC)


# Add subdirectories

add_subdirectory(auxlib)
add_subdirectory(samples)


# Build coordinator and utilities

add_executable(ypspur-coordinator
Expand Down
6 changes: 5 additions & 1 deletion cmake/modules/FindSSM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ find_path(SSM_INCLUDE_DIRS ssm.h
HINTS ENV SSM_DIR
PATH_SUFFIXES include
)
find_library(SSM_LIBRARIES
find_library(SSM_LIBRARIES_FOUND
NAMES ssm
HINTS ENV SSM_DIR
)
if(SSM_LIBRARIES_FOUND)
set(SSM_LIBRARIES ssm)
endif(SSM_LIBRARIES_FOUND)

find_program(SSM_EXECUTABLE
NAMES ssm-coordinator
)
Expand Down
6 changes: 3 additions & 3 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ add_executable(cartesian2d-test
cartesian2d-test.c
)
target_link_libraries(cartesian2d-test
carte2d
carte2d${TARGET_STATIC_POSTFIX}
)

add_executable(MOI-estimate
MOI-estimate.c
)
target_link_libraries(MOI-estimate
ypspur
ypspur${TARGET_STATIC_POSTFIX}
)

add_executable(run-test
run-test.c
)
target_link_libraries(run-test
ypspur
ypspur${TARGET_STATIC_POSTFIX}
)

0 comments on commit bf6821e

Please sign in to comment.