Advertisement
bytecounter

Untitled

Oct 5th, 2022
1,302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.92 KB | None | 0 0
  1. if(WITH_LIB_GLAD_EXAMPLE_CBASIC AND WITH_EXAMPLES)
  2.     if(NOT WITH_LIB_GLAD)
  3.         message(FATAL_ERROR "Try to build example WITH_LIB_GLAD_EXAMPLE_CBASIC without WITH_LIB_GLAD")
  4.     endif()
  5.  
  6.     message(STATUS "Building example WITH_LIB_GLAD_EXAMPLE_CBASIC")
  7.  
  8.     set(LIB_GLAD_EXAMPLE_CBASIC_SRC ${CMAKE_SOURCE_DIR}/source/examples/glad/basic/basic.c)
  9.     set(LIB_GLAD_EXAMPLE_CBASIC_COMPILER gcc)
  10.     set(LIB_GLAD_EXAMPLE_CBASIC_C_FLAGS_RELEASE "-O3 -Wall -Werror")
  11.     set(LIB_GLAD_EXAMPLE_CBASIC_C_FLAGS_DEBUG "-g -Wall -Werror")
  12.     set(LIB_GLAD_EXAMPLE_CBASIC_INSTALL_PATH "${OUTPUT_PATH}/examples/glad/basic/")
  13.     set(LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE "glad-basic")
  14.     set(LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_DEBUG "glad-basic_debug")
  15.  
  16.     add_executable(LIB_GLAD_EXAMPLE_CBASIC ${LIB_GLAD_EXAMPLE_CBASIC_SRC})
  17.  
  18.     set(CMAKE_C_COMPILER ${LIB_GLAD_EXAMPLE_CBASIC_COMPILER})
  19.     if(CMAKE_RELEASE_TYPE )
  20.         set(CMAKE_C_LINKER_FLAGS ${LIB_GLAD_EXAMPLE_CBASIC_C_FLAGS_DEBUG})
  21.     else()
  22.         set(CMAKE_C_LINKER_FLAGS ${LIB_GLAD_EXAMPLE_CBASIC_C_FLAGS_RELEASE})
  23.     endif()
  24.    
  25.  
  26.     target_include_directories(LIB_GLAD_EXAMPLE_CBASIC PRIVATE ${LIB_GLAD_INC_PATH})
  27.     target_link_directories(LIB_GLAD_EXAMPLE_CBASIC PRIVATE ${LIB_GLAD_LIB_PATH})
  28.     target_link_libraries(LIB_GLAD_EXAMPLE_CBASIC PRIVATE ${LIB_GLAD_STATIC_LIBS})
  29.  
  30.     set(THREADS_PREFER_PTHREAD_FLAG ON)
  31.     target_link_libraries(LIB_GLAD_EXAMPLE_CBASIC PRIVATE Threads::Threads)
  32.     cmake_print_variables(LIB_GLAD_INC_PAH LIB_GLAD_LIB_PATH LIB_GLAD_STATIC_LIBS)
  33.  
  34.        
  35.     set_target_properties(LIB_GLAD_EXAMPLE_CBASIC PROPERTIES RELEASE_OUTPUT_NAME ${LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE})
  36.     set_target_properties(LIB_GLAD_EXAMPLE_CBASIC PROPERTIES DEBUG_OUTPUT_NAME ${LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_DEBUG})
  37.     set_target_properties(LIB_GLAD_EXAMPLE_CBASIC PROPERTIES LINKER_LANGUAGE C)
  38.  
  39.     install(
  40.         TARGETS LIB_GLAD_EXAMPLE_CBASIC
  41.         RUNTIME DESTINATION ${LIB_GLAD_EXAMPLE_CBASIC_INSTALL_PATH}
  42.     )
  43. endif()
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement