Skip to content

Instantly share code, notes, and snippets.

@yashi
Last active February 21, 2024 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashi/2547bb452f315c677be53315fecfd2dc to your computer and use it in GitHub Desktop.
Save yashi/2547bb452f315c677be53315fecfd2dc to your computer and use it in GitHub Desktop.
CMakeLists.txt for Python C Extension module
cmake_minimum_required(VERSION 3.20)
project(python_module)
find_package(Python3 COMPONENTS Development.Module)
#Python_add_library(hello MODULE hello.c)
add_library(hello SHARED hello.c)
target_include_directories(hello PRIVATE ${Python_INCLUDE_DIRS})
target_link_libraries(hello Python3::Module)
set_target_properties(hello PROPERTIES PREFIX "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment