unclearness/vacancy

Unable to compile with VACANCY_USE_STB_AS_STATIC_LIB=ON

Closed this issue · 1 comments

Hello,

Thanks for the nice library!

I'm trying to compile with VACANCY_USE_STB_AS_STATIC_LIB=ON but no luck.

Steps to reproduce:

git clone https://github.com/unclearness/vacancy.git
cd vacancy
git submodule init
git submodule update
mkdir build
cd build
cmake .. -DVACANCY_USE_OPENMP=OFF -DVACANCY_USE_STB_AS_STATIC_LIB=ON
make

Error:

...

examples.cc:(.text.startup+0x35d): undefined reference to `stbi_write_png'
examples.cc:(.text.startup+0xbff): undefined reference to `stbi_load'

...

Environment:

  1. Ubuntu 18.04
  2. cmake version 3.10.2
  3. GNU Make 4.1
  4. gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

PS

I temporarily fixed it by changing this

if (VACANCY_USE_STB)
  target_compile_definitions(${PUBLIC_LIB_NAME} PUBLIC -DVACANCY_USE_STB)
endif()

to this

if (VACANCY_USE_STB)
  target_compile_definitions(${STB_LIB_NAME} PUBLIC -DVACANCY_USE_STB)
  target_include_directories(${STB_LIB_NAME} PUBLIC third_party)
endif()

but not sure how correct it is.

Thank you for reporting the bug. I reproduced and fixed it.