-
Notifications
You must be signed in to change notification settings - Fork 49
/
CMakeLists.txt
54 lines (44 loc) · 1.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
project(OMSimulator)
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib/${HOST_SHORT}:$ORIGIN/")
include_directories(
../OMSimulatorLib
../OMSysIdentLib
../OMSimulatorLua
${LUALibrary_INCLUDEDIR})
link_directories(
${FMILibrary_LIBRARYDIR}
${LUALibrary_LIBRARYDIR}
${CVODELibrary_LIBRARYDIR}
${KINSOLLibrary_LIBRARYDIR}
${Boost_LIBRARY_DIRS}
${MINIZIP_LIBRARYDIR})
IF (OMTLM)
link_directories(${OMTLMSIMULATORLIB_LIBRARYDIR})
ENDIF ()
add_executable(OMSimulator main.cpp)
IF (BOOST_ROOT AND MINGW)
# For some reason the above link_directories is ignored when cross-compiling MinGW64...
target_link_libraries(OMSimulator "-L${BOOST_ROOT}/lib")
message(STATUS BOOST_ROOT MinGW64 workaround active)
ENDIF ()
IF (APPLE)
add_custom_command(TARGET OMSimulator POST_BUILD COMMAND
${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@loader_path/../../../../lib/${HOST_SHORT}"
$<TARGET_FILE:OMSimulator>)
add_custom_command(TARGET OMSimulator POST_BUILD COMMAND
${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@loader_path/../lib/${HOST_SHORT}"
$<TARGET_FILE:OMSimulator>)
ENDIF ()
IF (Ceres_FOUND AND OMSYSIDENT)
add_definitions(-DWITH_OMSYSIDENT)
set(OMSYSIDENT_OPTION OMSysIdent_static)
ENDIF()
IF (WIN32 AND MINGW)
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
ENDIF ()
add_definitions(-DOMS_STATIC)
target_link_libraries(OMSimulator OMSimulatorLib_static lua ${OMSYSIDENT_OPTION})
IF (NOT BUILD_SHARED)
target_link_libraries(OMSimulator -static)
ENDIF ()
install(TARGETS OMSimulator DESTINATION bin)