File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -133,3 +133,27 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake
133133install (EXPORT ${PROJECT_NAME} -targets
134134        FILE  ${PROJECT_NAME} Targets.cmake
135135        DESTINATION  ${PYBIND11_JSON_CMAKECONFIG_INSTALL_DIR} )
136+ 
137+ # pkg-config support 
138+ if (NOT  prefix_for_pc_file)
139+ if (IS_ABSOLUTE  "${CMAKE_INSTALL_DATAROOTDIR} " )
140+   set (prefix_for_pc_file "${CMAKE_INSTALL_PREFIX} " )
141+ else ()
142+   set (pc_datarootdir "${CMAKE_INSTALL_DATAROOTDIR} " )
143+   if (CMAKE_VERSION  VERSION_LESS  3.20)
144+     set (prefix_for_pc_file "\$ {pcfiledir}/.." )
145+     while (pc_datarootdir)
146+       get_filename_component (pc_datarootdir "${pc_datarootdir} "  DIRECTORY )
147+       string (APPEND  prefix_for_pc_file "/.." )
148+     endwhile ()
149+   else ()
150+     cmake_path(RELATIVE_PATH CMAKE_INSTALL_PREFIX  BASE_DIRECTORY CMAKE_INSTALL_DATAROOTDIR
151+                OUTPUT_VARIABLE  prefix_for_pc_file)
152+   endif ()
153+ endif ()
154+ endif ()
155+ set (includedir_for_pc_file "\$ {prefix}/${CMAKE_INSTALL_INCLUDEDIR} " )
156+ configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /pybind11_json.pc.in" 
157+              "${CMAKE_CURRENT_BINARY_DIR} /pybind11_json.pc"  @ONLY)
158+ install (FILES  "${CMAKE_CURRENT_BINARY_DIR} /pybind11_json.pc" 
159+       DESTINATION  "${CMAKE_INSTALL_DATAROOTDIR} /pkgconfig/" )
Original file line number Diff line number Diff line change 1+ prefix=@prefix_for_pc_file@
2+ includedir=@includedir_for_pc_file@
3+ 
4+ Name: @PROJECT_NAME@
5+ Description: Using nlohmann::json with pybind11
6+ Version: @PROJECT_VERSION@
7+ Cflags: -I${includedir}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments