hoene / libmysofa

Reader for AES SOFA files to get better HRTFs
Other
137 stars 73 forks source link

Enable POSITION_INDEPENDENT_CODE just when BUILD_SHARED_LIBS is on #177

Closed fjtrujy closed 2 years ago

fjtrujy commented 2 years ago

Otherwise, it could suffer compilation issues when cross-compiling (I'm compiling library for PSP)

make 
Scanning dependencies of target mysofa-static
[  4%] Building C object src/CMakeFiles/mysofa-static.dir/hrtf/reader.c.obj
cc1: error: cannot generate position-independent code for ‘-mabi=eabi’
make[2]: *** [src/CMakeFiles/mysofa-static.dir/hrtf/reader.c.obj] Error 1
make[1]: *** [src/CMakeFiles/mysofa-static.dir/all] Error 2
make: *** [all] Error 2

Thanks

fjtrujy commented 2 years ago

Hello @hoene, Why directly you close the PR?

The POSITION_INDEPDENT_CODE is wrongly set.

You can see here more information: https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html#prop_tgt:POSITION_INDEPENDENT_CODE

It says:

This property is True by default for SHARED and MODULE library targets and False otherwise.

I'm compiling with the flags for disabling shared libs, but even like this is still suffering this compilation issue

hoene commented 2 years ago

@fjtrujy Sorry, I have hit the wrong button. It's merged now.

fjtrujy commented 2 years ago

Thanks!!