Skip to content

Commit

Permalink
Added fPIC for linux building
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Machulis <[email protected]>
  • Loading branch information
qdot committed Nov 23, 2010
1 parent ab64736 commit 2d9dcd0
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions c/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ include_directories(${USB_INCLUDE_DIRS})
SET(SRC core.c tilt.c cameras.c usb_libusb10.c)

if (NOT PROJECT_OS_WIN)
add_library (freenect SHARED ${SRC})
set_target_properties ( freenect PROPERTIES
VERSION ${PROJECT_VER}
SOVERSION ${PROJECT_APIVER})
install (TARGETS freenect
DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}")
add_library (freenect SHARED ${SRC})
set_target_properties ( freenect PROPERTIES
VERSION ${PROJECT_VER}
SOVERSION ${PROJECT_APIVER})
install (TARGETS freenect
DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}")
endif (NOT PROJECT_OS_WIN)

add_library (freenectstatic STATIC ${SRC})
set_target_properties (freenectstatic PROPERTIES
OUTPUT_NAME freenect)
set_target_properties (freenectstatic PROPERTIES OUTPUT_NAME freenect)
IF(UNIX AND NOT APPLE)
SET_TARGET_PROPERTIES (freenectstatic PROPERTIES COMPILE_FLAGS "-fPIC")
ENDIF()
install (TARGETS freenectstatic
DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}")
DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}")

find_library (PTHREAD pthread)
target_link_libraries (freenect ${CMAKE_THREAD_LIBS_INIT} ${USB_LIBRARIES})
target_link_libraries (freenectstatic ${CMAKE_THREAD_LIBS_INIT} ${USB_LIBRARIES})

# Install the header file
install (FILES "../include/libfreenect.h" "../include/libfreenect.hpp"
DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})

0 comments on commit 2d9dcd0

Please sign in to comment.