I have a project that primarily uses CMake.
However, there is a subdirectory from a 3rd party / legacy library. It has a Makefile that will compile itself into a 3rd_party.a library file.
Can my own CMakeLists.txt manage to call that Makefile, generate its 3rd_party.a library, and let my code link to it? I don't want to adapt its legacy Makefile into CMakeLists.txt
├── my_source_folder_1
├── my_source_folder_2
├── CMakeLists.txt
├── 3rd_party
│ ├── 3rd_party_source
│ ├── 3rd_party_make
│ | ├── Makefile
Thanks!
Related: http://www.cmake.org/pipermail/cmake/2010-November/040631.html
From the link above, it appears that you can use a special command to outline how CMake should make the target:
add_custom_target(
extern_lib
COMMAND make
WORKING_DIRECTORY full_path to where Makefile is located
)
add_executable(myexecutable myexcutable.c)
target_link_libraries(myexecutable full_path_to_generated_library)
add_dependencies(myexecutable extern_lib)
This should be enough to get you off the ground.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With