Partial fix for compiling statically on Windows

release/4.3a0
Richard Roberts 2013-05-13 18:04:36 +00:00
parent fcfb27440a
commit 50866b9a0e
2 changed files with 13 additions and 3 deletions

View File

@ -101,7 +101,9 @@ if (GTSAM_BUILD_STATIC_LIBRARY)
VERSION ${gtsam_version} VERSION ${gtsam_version}
SOVERSION ${gtsam_soversion}) SOVERSION ${gtsam_soversion})
if(WIN32) # Add 'lib' prefix to static library to avoid filename collision with shared library if(WIN32) # Add 'lib' prefix to static library to avoid filename collision with shared library
set_target_properties(gtsam-static PROPERTIES PREFIX "lib") set_target_properties(gtsam-static PROPERTIES
PREFIX "lib"
COMPILE_DEFINITIONS GTSAM_IMPORT_STATIC)
endif() endif()
install(TARGETS gtsam-static EXPORT GTSAM-exports ARCHIVE DESTINATION lib) install(TARGETS gtsam-static EXPORT GTSAM-exports ARCHIVE DESTINATION lib)
list(APPEND GTSAM_EXPORTED_TARGETS gtsam-static) list(APPEND GTSAM_EXPORTED_TARGETS gtsam-static)
@ -149,7 +151,10 @@ if (GTSAM_INSTALL_MATLAB_TOOLBOX)
set(GTSAM_LIB_DIR ${MEX_LIB_ROOT}/gtsam) # FIXME: is this used? set(GTSAM_LIB_DIR ${MEX_LIB_ROOT}/gtsam) # FIXME: is this used?
# Generate, build and install toolbox # Generate, build and install toolbox
set(mexFlags ${GTSAM_BUILD_MEX_BINARY_FLAGS} -I${MEX_INCLUDE_ROOT} -I${Boost_INCLUDE_DIR} -I${CMAKE_BINARY_DIR}) set(mexFlags ${GTSAM_BUILD_MEX_BINARY_FLAGS} -I${MEX_INCLUDE_ROOT} -I${Boost_INCLUDE_DIR} -I${CMAKE_BINARY_DIR})
if("${gtsam-default}" STREQUAL "gtsam-static")
list(APPEND mexFlags -DGTSAM_IMPORT_STATIC)
endif()
# Macro to handle details of setting up targets # Macro to handle details of setting up targets
# FIXME: issue with dependency between wrap_gtsam and wrap_gtsam_build, only shows up on CMake 2.8.3 # FIXME: issue with dependency between wrap_gtsam and wrap_gtsam_build, only shows up on CMake 2.8.3

View File

@ -58,7 +58,9 @@ if (GTSAM_BUILD_STATIC_LIBRARY)
VERSION ${gtsam_unstable_version} VERSION ${gtsam_unstable_version}
SOVERSION ${gtsam_unstable_soversion}) SOVERSION ${gtsam_unstable_soversion})
if(WIN32) # Add 'lib' prefix to static library to avoid filename collision with shared library if(WIN32) # Add 'lib' prefix to static library to avoid filename collision with shared library
set_target_properties(gtsam_unstable-static PROPERTIES PREFIX "lib") set_target_properties(gtsam_unstable-static PROPERTIES
PREFIX "lib"
COMPILE_DEFINITIONS GTSAM_UNSTABLE_IMPORT_STATIC)
endif() endif()
target_link_libraries(gtsam_unstable-static gtsam-static ${GTSAM_UNSTABLE_BOOST_LIBRARIES}) target_link_libraries(gtsam_unstable-static gtsam-static ${GTSAM_UNSTABLE_BOOST_LIBRARIES})
install(TARGETS gtsam_unstable-static EXPORT GTSAM-exports ARCHIVE DESTINATION lib) install(TARGETS gtsam_unstable-static EXPORT GTSAM-exports ARCHIVE DESTINATION lib)
@ -100,6 +102,9 @@ if (GTSAM_INSTALL_MATLAB_TOOLBOX)
# Generate, build and install toolbox # Generate, build and install toolbox
set(mexFlags -I${MEX_INCLUDE_ROOT} -I${Boost_INCLUDE_DIR} -I${CMAKE_BINARY_DIR}) set(mexFlags -I${MEX_INCLUDE_ROOT} -I${Boost_INCLUDE_DIR} -I${CMAKE_BINARY_DIR})
if("${gtsam-default}" STREQUAL "gtsam-static")
list(APPEND mexFlags -DGTSAM_IMPORT_STATIC)
endif()
# Macro to handle details of setting up targets # Macro to handle details of setting up targets
wrap_library(gtsam_unstable "${mexFlags}" "./" gtsam) wrap_library(gtsam_unstable "${mexFlags}" "./" gtsam)