Ok, that works, but doesn't solve my next problem:
I'm wanting to use cmake to create a static library of my project.
The project (libspam) has the directory structure:
CMakeLists.txt
common/CMakeLists.txt
common/test.h
common/test.c
other/CMakeLists.txt
other/test2.c
other/test2.h
Where the root path CMakeLists.txt is:
Code:
project(LIBSPAM)
add_subdirectory(common)
add_subdirectory(other)
# create static lib
add_library(spam STATIC common/test.c other/test2.c)
target_link_libraries(spam usb-1.0)
install (TARGETS spam DESTINATION lib)
install(FILES common/test.c other/test2.c DESTINATION include)
And common/CMakeLists.txt is:
Code:
cmake_minimum_required(VERSION 2.8)
add_library(common test)
And other/CMakeLists.txt is:
Code:
cmake_minimum_required(VERSION 2.8)
add_library(other test2)
While this works, the header file include paths are:
#include "../common/test.h"
#include "../other/test2.h"
So if I installed these header files, it may overwrite some similar named files, and the above include paths are wrong for other programs that use these header files. How can I set the include paths to:
#include "libspam/common/test.h"
#include "libspam/other/test2.h"
And get cmake to install these headers in /usr/local/lib/libspam/