diff --git a/auto2cmake.py b/auto2cmake.py index aab55e6..7d4021d 100755 --- a/auto2cmake.py +++ b/auto2cmake.py @@ -75,7 +75,7 @@ def __init__(self, directory): self.directory = directory # The directory where this can be found self.contained_libraries_content = [] # All the content of the libraries that are created in here self.libraries = [] # All the libraries that are created by this file - self.extra_content = "" # Extra stuff such as add_subdriectory + self.extra_content = "" # Extra stuff such as add_subdirectory ######################################################################################################################## # Whether a target is a library (noinst_LIBRARIES) or an application (bin_PROGRAMS) @@ -127,7 +127,7 @@ def __init__(self, name, directory): ######################################################################################################################## -# represents an option that will go in the CMakeLists.txt and also in the generated header if has a define +# represents an option that will go in the CMakeLists.txt and also in the generated header if it has a define ######################################################################################################################## class Option: @@ -652,7 +652,7 @@ def process_makefile_am(file): ######################################################################################################################## -# processes all the libraries, creates the requested CMakeFile list ofthe application +# processes all the libraries, creates the requested CMakeFile list of the application ######################################################################################################################## def process_libraries(): for library in libraries: @@ -909,8 +909,8 @@ def filelist_to_string(elements, source_directory, spacecount = 4): if os.path.isfile(source_directory + "/" + file): filelist += "\n" +" " * spacecount + "${CMAKE_CURRENT_SOURCE_DIR}/" + file else: - filelist += "\n#" +" " * spacecount + "${CMAKE_CURRENT_SOURCE_DIR}/" + file + " # File not found. Fix manually" - warning("WARNING!!! The file: " + source_directory + "/" + file + " is present in the Makefile.am but cannot be found in the filesystem") + filelist += "\n#" +" " * spacecount + "${CMAKE_CURRENT_SOURCE_DIR}/" + file + " # File not found. Fix manually." + warning("WARNING!!! The file: " + source_directory + "/" + file + " is present in the Makefile.am but cannot be found in the filesystem.") return filelist ######################################################################################################################## @@ -989,7 +989,7 @@ def process_configure_ac(fname): # Add it in there config_ac_variables[varname]["value"].append(var_value) - # And finally see if this is somethign we can work with + # And finally see if this is something we can work with method = processable_line(current_line) if method: full_line = "" @@ -1051,7 +1051,7 @@ def process_configure_ac(fname): ######################################################################################################################## def generate_default_cmake(req_dir): projname = req_dir.split("/")[-1] + ")\n" - sources = "set (project " + sources = "project(" sources += projname sources += ")\nset(${project}_SOURCES\n" files = glob.glob(req_dir + "/*.c*") @@ -1064,8 +1064,12 @@ def generate_default_cmake(req_dir): sources += ")\n" r_cmake_file = open(req_dir + "/CMakeLists.txt", "w") - r_cmake_file.write("cmake_minimum_required(VERSION 2.8)\n") + r_cmake_file.write("cmake_minimum_required(VERSION 3.24)\n") r_cmake_file.write(sources) +# r_cmake_file.write( VERSION 1.0.0.0) +# r_cmake_file.write( DESCRIPTION "Your description here") +# r_cmake_file.write( HOMEPAGE_URL "https://www.example.com") +# r_cmake_file.write( LANGUAGES ")\n\n",) r_cmake_file.write("add_library(${project} STATIC ${${project}_SOURCES} )") r_cmake_file.close() @@ -1116,11 +1120,11 @@ def create_cmakefile(path, cpps, headers, module): f = open(pjoin(path,"CMakeLists.txt"), "w+") - f.write("cmake_minimum_required(VERSION 2.8)\n") + f.write("cmake_minimum_required(VERSION 3.24)\n") if full_module: - f.write("set (project " + full_module + ")\n\n") + f.write("project(" + full_module + ")\n\n") else: - f.write("set (project " + module + ")\n\n") + f.write("project(" + module + ")\n\n") full_module = module if cpps: @@ -1354,7 +1358,7 @@ def convert_qmake_project(dir, fn): cmake_file = open(dir + "/CMakeLists.txt", "w") cmake_file.write("# Autogenerated by auto2cmake on {0}\n\n".format(time.strftime("%Y-%m-%d %H:%M:%S"))) - cmake_file.write("cmake_minimum_required(VERSION 2.8)\n\n") + cmake_file.write("cmake_minimum_required(VERSION 3.24)\n\n") cmake_file.write("set(project \"" + qmake_target_name + "\")\n") cmake_file.write("project (${project})\n\n") @@ -1512,7 +1516,7 @@ def convert(): format(time.strftime("%Y-%m-%d %H:%M:%S"))) # let's not be very cmake hungry - cmake_file.write("cmake_minimum_required(VERSION 2.8)\n") + cmake_file.write("cmake_minimum_required(VERSION 3.24)\n") sorted_options = sorted(options.items(), key=lambda x: x[1].get_name(), reverse=False) for option in sorted_options: @@ -1559,7 +1563,7 @@ def convert(): cmake_file.write("\n") cmake_file.write("## !!! WARNING These are the defines that were defined regardless of an option.\n" - "## !!! Or the script couldn't match them. Match them accordingly, delete them or keep them\n") + "## !!! Or the script couldn't match them. Match them accordingly, delete them or keep them.\n") # Now put out all the temp_defines that are still not used for temp_define_name in temp_defines: @@ -1612,7 +1616,7 @@ def convert(): # and generate in there manually, after removing the entries which are in the do not include list final_list = [x for x in required_directories if not should_exclude(x)] - warning("WARNING!!! Creating default CMakeLists.txt in the directories below. Don't forget to fix these later") + warning("WARNING!!! Creating default CMakeLists.txt in the directories below. Don't forget to fix these later!") for req_dir in final_list: warning("Default CMakeLists.txt in:", req_dir) generate_default_cmake(req_dir)