cbkiyanda / cspl

Common Scientific Programming Library
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Fix missing symbols in library. #1

Closed nicolasbock closed 9 years ago

nicolasbock commented 9 years ago

As of CMake 2.8 one can build libraries using the OBJECT feature, so that several libraries can be combined into one using only the add_library() function. The POSITION_INDENPENDENT_CODE property needs to be set in case the user wants shared libraries (-DBUILD_SHARED_LIBS=yes).

balarsen commented 9 years ago

Interesting on the errors, my mac has cmake 3.0.1 and I get errors without the cmake_policy(SET CMP0042 NEW)

balarsen commented 9 years ago

CMake Warning (dev): Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake --help-policy CMP0042" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

MACOSX_RPATH is not specified for the following targets:

CSPL

This warning is for project developers. Use -Wno-dev to suppress it.

balarsen commented 9 years ago

We can try and do a version dependent check and set this for the new versions.

balarsen commented 9 years ago

The set_target_properties( CSPL_Stats PROPERTIES POSITION_INDEPENDENT_CODE TRUE ) was the piece I did not get right, I tried this OBJECT way.

balarsen commented 9 years ago

Sorry for the 1e6 posts. It was not the fPIC thing (macs don't need that, BSD compiler not GNU). I was chaining the add_subdirectory() commands between root and and CSPL to Stats.