diff --git a/CMakeLists.txt b/CMakeLists.txt index bdf1421..bbf5d6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,22 +7,30 @@ if(NOT DEFINED STEINWURF_RESOLVE) COMMAND python waf resolve WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set(STEINWURF_RESOLVE "${CMAKE_CURRENT_SOURCE_DIR}/resolve_symlinks") + set(CPUID_TOPLEVEL 1) endif() file(GLOB cpuid_headers ./src/cpuid/*.hpp) file(GLOB_RECURSE cpuid_sources ./src/*.cpp) -add_library(cpuid STATIC ${cpuid_sources}) -add_library(steinwurf::cpuid ALIAS cpuid) + +add_library(cpuid_objects OBJECT ${cpuid_sources}) +add_library(steinwurf::cpuid ALIAS cpuid_objects) if (NOT TARGET platform) add_subdirectory("${STEINWURF_RESOLVE}/platform" platform EXCLUDE_FROM_ALL) endif() -target_link_libraries(cpuid PRIVATE steinwurf::platform) +target_link_libraries(cpuid_objects PRIVATE steinwurf::platform) -target_compile_features(cpuid PUBLIC cxx_std_11) +target_compile_features(cpuid_objects PUBLIC cxx_std_11) -target_include_directories(cpuid INTERFACE src) +target_include_directories(cpuid_objects INTERFACE src) install(FILES ${cpuid_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/cpuid) + + +if (DEFINED CPUID_TOPLEVEL) +add_library(cpuid STATIC $) install(FILES $ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +endif() +