SFML / cmake-sfml-project

Repository template for SFML projects using CMake
Other
269 stars 162 forks source link

The install target includes all SFML options, including pkg-config and cmake configuration #39

Open K20shores opened 3 months ago

K20shores commented 3 months ago

The default installation includes all of the SFML development information. I'm

git clone https://github.com/SFML/cmake-sfml-project.git
cd cmake-sfml-project/
mkdir build && cd build
cmake ..
make -j
make install

On ubuntu this gives me

[100%] Built target sfml-audio
Install the project...
-- Install configuration: ""
CMake Error at _deps/sfml-build/cmake_install.cmake:54 (file):
  file cannot create directory: /usr/local/lib/pkgconfig.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  cmake_install.cmake:47 (include)

make: *** [Makefile:120: install] Error 1

Which, yes, with admin privileges would work. But also that would be installing SFML and not the binary. You can make this go away by specifying an install prefix cmake -DCMAKE_INSTALL_PREFIX=install .. but then you're still installing the SFML stuff.

Is that expected? If not, how can I prevent that from happening?

K20shores commented 3 months ago

Seems like populating sfml by hand would all EXCLUDE_FROM_ALL to be added to the add_subdirectory call, but for some reason I can't get it work.

  # FetchContent_MakeAvailable(SFML)
  FetchContent_GetProperties(SFML)
  message(STATUS "SFML source dir: ${SFML_SOURCE_DIR}") 
  message(STATUS "SFML binary dir: ${SFML_BINARY_DIR}")

for me this produces empty values for the source and binary directory so I can't add the subdirectories

eXpl0it3r commented 3 months ago

See also #28