-need to add "add_definitions(-D__unix)" for BSD case in CMakeLists.txt to correct error below
In file included from /home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/include/stratagus.h:149,
from /home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/metaserver/cmd.cpp:40:
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/include/util.h:44:22: error: winsock2.h: No such file or directory
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/include/util.h:45:21: error: windows.h: No such file or directory
-need to remove "&" from template function "for_each" in unit_cache.h to correct error below
In file included from /home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/ai/ai_building.cpp:44:
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/ai/ai_local.h: In member function 'void AiForce::Reset(bool)':
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/ai/ai_local.h:140: error: no matching function for call to 'CUnitCache::for_each(void ()(CUnit*))'
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/include/unit_cache.h:135: note: candidates are: void CUnitCache::for_each(_T&) [with _T = void ()(CUnit*)]
gmake[2]: *** [CMakeFiles/stratagus.dir/src/ai/ai_building.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/stratagus.dir/all] Error 2
gmake: *** [all] Error 2
-need to add "#if defined (USE_BSD)" case in util.cpp to correct error below
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/stratagus/util.cpp: In constructor 'CMutex::CMutex()':
/home/neutrino/wrk/stratagus/stratagus_2.2.6.orig/src/stratagus/util.cpp:493: error: 'pthread_mutexattr_setpshared' was not declared in this scope
gmake[2]: *** [CMakeFiles/stratagus.dir/src/stratagus/util.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/stratagus.dir/all] Error 2
gmake: *** [all] Error 2
-need to add "/usr/local/lib/liblcms.so.2.0" and "/usr/local/lib/libjpeg.so.64.0" to CMakeLists.txt to correct error below
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsOpenProfileFromMem'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_read_scanlines'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsDoTransform'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsErrorAction'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsCreateRGBProfile'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_start_decompress'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsFreeGamma'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_destroy_decompress'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_std_error'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_CreateDecompress'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_has_multiple_scans'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsOpenProfileFromFile'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsCloseProfile'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_input_complete'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_read_header'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_destroy_compress'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_finish_decompress'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_resync_to_restart'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsDeleteTransform'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsCreateTransform'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_finish_output'
/usr/local/lib/libmng.so.3.1: undefined reference to `jpeg_start_output'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsBuildGamma'
/usr/local/lib/libmng.so.3.1: undefined reference to `cmsWhitePointFromTemp'
collect2: ld returned 1 exit status
gmake[2]: *** [stratagus] Error 1
gmake[1]: *** [CMakeFiles/stratagus.dir/all] Error 2
gmake: *** [all] Error 2
Thanks for patches!
util.cpp and unit_cache.h looks good. Also adding -D__unix for BSD is Ok. But problem is adding other local libraries for linking.
From your buildlog I see that external library libmng.so.3.1 depends on externals libraries liblcms.so.2.0 and libjpeg.so.64.0. This is platform specified dependency of external library which should be fixed in CMake (maybe cmake/modules/ FindMNG. cmake?) . I do not know how OpenBSD handling library dependences, but tested linux distributions do not have this problem.
Do you know any project/program which using CMake build systemm using MNG library and working fine on BSD? I think that this problem was in other projects too and maybe it is solved...