TheAlgorithms/C

[OTHER] Add `process_scheduling_algorithms` to CMake

Panquesito7 opened this issue · 1 comments

What would you like to share?

All folders should be included in the CMake file to run the tests properly and make sure the code fits our standards.
This new folder, which is named process_scheduling_algorithms, isn't added to CMakeLists and should be added as soon as possible.

Steps to contribute

If you've already forked the repository, skip to step 3

  1. Fork the repository here.
  2. Make a new branch named cmake_folder.
  3. Clone the forked repository with Git.
git clone https://github.com/<your-username>/C.git
  1. Open the CMakeLists.txt file in the root directory of your forked repository.
  2. After line 63 (when the machine_learning folder is being added), add the following code:
add_subdirectory(process_scheduling_algorithms)
  1. Save the current file.
  2. Make a new file named CMakeLists.txt under the process_scheduling_algorithms directory.
  3. Copy the content below onto the file.
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
# with full pathname. RELATIVE may makes it easier to extract an executable name
# automatically.
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c )
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
foreach( testsourcefile ${APP_SOURCES} )
    # I used a simple string replace, to cut off .cpp.
    string( REPLACE ".c" "" testname ${testsourcefile} )
    add_executable( ${testname} ${testsourcefile} )
    
    if(OpenMP_C_FOUND)
        target_link_libraries(${testname} OpenMP::OpenMP_C)
    endif()
    if(MATH_LIBRARY)
        target_link_libraries(${testname} ${MATH_LIBRARY})
    endif()
    install(TARGETS ${testname} DESTINATION "bin/process_scheduling_algorithms")

endforeach( testsourcefile ${APP_SOURCES} )
  1. Save the current file.
  2. Commit and push your changes.
  3. Create a pull request.
  4. You're done now! 🎉 You just have to wait until the maintainers check your pull request.

If you need any help, let us know here or on our Discord server! 🙂

Additional information

This is a good first issue. Please leave it open to first-time contributors and beginners.

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.