I am trying to use a header only library (thread-pool) as a sub project. So in root CMakeLists.txt
I have
ADD_SUBDIRECTORY(thread_pool)
inside thread-pool/CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(thread-pool)
SET(THREAD_POOL_SOURCES)
ADD_LIBRARY(thread-pool STATIC ${THREAD_POOL_SOURCES})
As this is a header only library with no source, it gives error.
CMake Error: CMake can not determine linker language for target: thread-pool
One solution is to use ADD_LIBRARY(thread-pool INTERFACE)
but that only works with CMake 3.0
and I've 2.8 installed. I am not asking for a solution on how to upgrade CMake to 3.0 but is there any alternative way that I can use with CMake 2.6 or 2.8
?
One way that comes in my mind is to have a fake cpp file with some dummy function and put that in sources, But that will be a bad solution.