wovo / hwlib

C++ OO micro-controller library for close-to-the-hardware programming
Boost Software License 1.0
57 stars 26 forks source link

adding cmakelists for including hwlib as a cmakelibrary #18

Closed CvRXX closed 5 years ago

CvRXX commented 6 years ago

This Cmake files makes it possible to add hwlib as a Cmake library. This could work as followed:

add_subdirectory(deps/hwlib)
target_link_libraries (project.elf hwlib)

This will then take care of all the necessary includes and build steps.

JulianvDoorn commented 6 years ago

In the provided example: To avoid confusion and potential errors add_subdirectory(deps/hwlib) should be include_directories(deps/hwlib) since add_subdirectory can't include non-descendant folders.

CvRXX commented 6 years ago

I totaly agree with the comment on the example, if there are no other problems. @wovo can you merge?

CvRXX commented 6 years ago

@JulianvDoorn This is not correct actually, add_subdirectory adds a folder where cmake will look for cmake files to find targets and libraries. include_directories will find header files (like example.hpp). So one should use add_subdirectory.