tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

cmake installation fail on ubuntu 18.04 #472

Closed guzhaoyuan closed 4 years ago

guzhaoyuan commented 4 years ago

I have installed from source using cmake + make on ubuntu 18.04. After building the src and sudo make install, xlnt seems to be installed correctly. image However, when I try to use the installed library from CMakeLists.txt, where I try to find the xlnt using find_package(Xlnt REQUIRED), cmake cannot set variables correctly. image My question is, what is the right way to include the installed library into my project. Are there any examples that I could look into?

guzhaoyuan commented 4 years ago

I am able to load the built library with the help of this issue.

I changed my CMakeList.txt to use LIST(APPEND CMAKE_MODULE_PATH /usr/local/lib/cmake/xlnt) # I have put Findxlnt.cmake in this folder find_package(xlnt MODULE), and in the build section, add_executable(read_xlsx src/read_xlsx.cpp) target_link_libraries(read_xlsx xlnt::xlnt).

This works for me.