cmake_minimum_required(VERSION 3.12) project(ClamShell) # Find Python find_package(Python REQUIRED COMPONENTS Interpreter Development) include_directories(${Python_INCLUDE_DIRS}) # Specify the target architectures (can be set via command line as well) if(NOT DEFINED CMAKE_OSX_ARCHITECTURES) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build architectures for macOS" FORCE) endif() # Add the source files of your library set(SOURCES src/lib.cpp ) # Add the header files of your library (not used for now) set(HEADERS include/lib.h ) # Create the shared library add_library(ClamShell SHARED ${SOURCES}) add_library(StaticClamShell STATIC ${SOURCES}) # Set the -fPIC flag set_target_properties(ClamShell PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(ClamShell PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ) target_include_directories(StaticClamShell PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ) target_link_libraries(ClamShell PRIVATE ${Python_LIBRARIES}) target_link_libraries(StaticClamShell PRIVATE ${Python_LIBRARIES}) if(APPLE) target_link_libraries(ClamShell PRIVATE "-framework Foundation" "-framework IOKit" ) target_link_libraries(StaticClamShell PRIVATE "-framework Foundation" "-framework IOKit" ) endif()