@@ -43,7 +43,6 @@ project(_cmd)
4343# ----- OS specific section
4444if (${PLATFORM} STREQUAL "WINDOWS" )
4545 message ("Running Windows build" )
46- find_package (Python COMPONENTS Interpreter Development.Module REQUIRED)
4746 add_library (opengl32 STATIC IMPORTED )
4847 set_target_properties (opengl32 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR} /pre-built/windows/libx64/OpenGL32.Lib)
4948
@@ -67,7 +66,6 @@ if (${PLATFORM} STREQUAL "WINDOWS")
6766 PYMOL_OPENMP
6867 # _HAVE_LIBXML # I had linker problems using this macro
6968 )
70- set (Venv_Python_EXE ${CMAKE_SOURCE_DIR} /.venv/Scripts/python)
7169endif ()
7270
7371if (${PLATFORM} STREQUAL "DARWIN" )
@@ -78,7 +76,6 @@ if (${PLATFORM} STREQUAL "DARWIN")
7876 set (LIB_DIR ${CMAKE_SOURCE_DIR} /vcpkg_installed/x64-osx/lib)
7977 endif ()
8078 # --- end
81- find_package (Python COMPONENTS Interpreter Development.Module REQUIRED)
8279 find_package (OpenGL REQUIRED)
8380
8481 set (ALL_COMPILER_ARGS
@@ -105,14 +102,12 @@ if (${PLATFORM} STREQUAL "DARWIN")
105102 _PYMOL_OSX
106103 # PYMOL_OPENMP # Not used in Schrödinger's build
107104 )
108- set (Venv_Python_EXE ${CMAKE_SOURCE_DIR} /.venv/bin/python)
105+
109106endif ()
110107
111108if (${PLATFORM} STREQUAL "GNU_LINUX" )
112109 # Add Linux specific options here
113110 message ("Running GNU Linux build" )
114- #find_package(Python3 ${PYTHON_VER} EXACT COMPONENTS Development REQUIRED)
115- find_package (Python COMPONENTS Interpreter Development.Module REQUIRED)
116111 set (LIB_DIR ${CMAKE_SOURCE_DIR} /vcpkg_installed/x64-linux/lib)
117112
118113 add_library (opengl32 STATIC IMPORTED )
@@ -133,7 +128,6 @@ if (${PLATFORM} STREQUAL "GNU_LINUX")
133128 set (OS_SPECIFIC_COMPILER_DEFS
134129 _HAVE_LIBXML
135130 )
136- set (Venv_Python_EXE ${CMAKE_SOURCE_DIR} /.venv/bin/python)
137131endif ()
138132# --- end
139133
@@ -377,7 +371,7 @@ set(ALL_SRC
377371)
378372python_add_library(_cmd MODULE WITH_SOABI ${ALL_SRC} ) # Default target
379373install (TARGETS _cmd DESTINATION pymol)
380-
374+ # add_library(_cmd MODULE ${ALL_SRC}) # Default CLion target
381375# ----- Target compile section
382376target_compile_options (_cmd PRIVATE ${ALL_COMPILER_ARGS} )
383377target_compile_features (_cmd PRIVATE cxx_std_17)
@@ -414,16 +408,22 @@ set (ALL_INCLUDE_DIR
414408target_include_directories (_cmd PUBLIC ${ALL_INCLUDE_DIR} )
415409# --- end
416410
411+ # ----- Packages section
412+ find_package (Python COMPONENTS Interpreter Development.Module REQUIRED)
413+ # The variable for the Python target is needed, otherwise CLion
414+ # does not recognize the build target as valid target and therefore CMake fails.
415+ set (PY_LIB Python::Python)
417416find_package (freetype CONFIG REQUIRED)
418417find_package (glew CONFIG REQUIRED)
419418find_package (PNG CONFIG REQUIRED)
420419find_package (libxml2 CONFIG REQUIRED)
421420find_package (netCDF CONFIG REQUIRED)
421+ # --- end
422422
423423# ----- Linker section
424424target_link_directories (_cmd PRIVATE ${LIB_DIR} ) # Refactor LIB_DIR to something more meaningful
425425target_link_options (_cmd PRIVATE ${OS_SPECIFIC_LINKER_OPTIONS} )
426- target_link_libraries (_cmd PRIVATE ${OS_SPECIFIC_LIBRARY_NAMES} Python )
426+ target_link_libraries (_cmd PRIVATE ${OS_SPECIFIC_LIBRARY_NAMES} ${PY_LIB} )
427427# --- end
428428
429429# ----- Champ section
@@ -444,9 +444,9 @@ python_add_library(_champ MODULE WITH_SOABI ${ALL_CHAMP_SRC})
444444# ----- Include section
445445set (ALL_CHAMP_INCLUDE_DIR
446446 contrib/champ
447+ pre-built/include
447448 ${OS_SPECIFIC_INCLUDES}
448449 ${Python3_INCLUDE_DIRS}
449- pre-built/include
450450)
451451target_include_directories (_champ PUBLIC ${ALL_INCLUDE_DIR} )
452452# --- end
0 commit comments