Reputation: 23
Why using find_package() ?
Why not just
include_directories(./extlibs/include/)
link_directories(./extlibs/lib/)
Then you link with your program:
target_link_libraries(${YOURPROJECT} libA libB)
?
I wonder because I see several reason to NOT use find_package:
Upvotes: 2
Views: 223
Reputation: 23294
Because I don't have a folder extlib
!
Ok, seriously, the setup from your computer is the setup from your computer only. If you want to develop just for your setup or a limited number of systems you can configure accordingly, you don't need CMake and its find_package mechanism. You could also use plain Makefiles or type compile commands to your terminal and use bash history.
find_package is handy to write general, cross-platform configure scripts. I don't even know where headers are installed on Windows systems. But when I write them the way CMake suggests it, it will just work and a Windows user does know how to tell your software where to look for headers, libraries and whatever needs to be done.
Concerning your reasons not use it:
Upvotes: 5